Ole Ole - 5 months ago 27
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?

TIA,
Ole

Ole Ole
Answer
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)
Comments