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?
3. Starting a Shell in an Alpine Container. Alpine is the most lightweight Linux distribution. Due to its small size, many people are using Alpine as their base image.
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
)-i
Interactive mode (Keep STDIN open even if not attached)-t
Allocate a pseudo-TTYUsually, an Alpine Linux image doesn't contain bash
, Instead you can use /bin/ash
, /bin/sh
, ash
or only sh
.
/bin/ash
docker run -it --rm alpine /bin/ash
/bin/sh
docker run -it --rm alpine /bin/sh
ash
docker run -it --rm alpine ash
sh
docker run -it --rm alpine sh
I hope this information helps you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With