本文介绍了在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
发布评论