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