在Docker Alpine容器中启动Shell [英] Starting a shell in the Docker Alpine container
本文介绍了在Docker Alpine容器中启动Shell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
要为Ubuntu映像启动交互式shell,可以运行:
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
但是当为 Alpine Docker映像运行时,会产生以下结果:>
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
在Alpine基本容器中启动交互式shell的命令是什么?
What is the command for starting an interactive shell in an Alpine base container?
推荐答案
ole@T:~$ docker run -it --rm alpine /bin/ash
(inside container) / #
上面使用的选项:
-
/bin/ash
是提供的Ash( Almquist Shell )通过BusyBox -
--rm
退出(docker run --help
)时自动删除容器 -
-i
交互模式(即使未连接也保持STDIN打开) -
-t
分配伪TTY
/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-TTY
这篇关于在Docker Alpine容器中启动Shell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文