Ole Ole - 2 years ago 153
Linux Question

Starting a Shell in the Docker Alpine Container

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

ole@T:~$ docker run -it --rm ubuntu
root@1a6721e1fb64:/# 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:

ole@T:~$ 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?


Ole Ole
Answer Source
ole@T:~$ 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