Ole Ole - 2 years ago 180
Linux Question

Starting a Shell in the Docker Alpine Container

To start an interactive shell for the ubuntu image we can run:

[email protected]:~$ docker run -it --rm ubuntu
[email protected]:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var


But when this is run for the Alpine Docker Image the following results:

[email protected]:~$ docker run -it --rm alpine
Error response from daemon: No command specified


What is the command for starting an interactive shell in an alpine base container?

TIA,
Ole

Ole Ole
Answer Source
[email protected]:~$ docker run -it --rm alpine /bin/ash
(inside container) / # 

Options used above:

  • /bin/ash is Ash (Almquist Shell) provided by BusyBox
  • --rm Automatically remove the container when it exits (docker run --help)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download