【发布时间】:2019-04-22 22:34:50
【问题描述】:
我无法将 bash shell 放入 alpine 容器中。
我从这个 Alpine 容器开始:
gitlab/gitlab-runner:alpine
我正在这个 dockerfile 中添加一个 bash shell 和其他配置:
from gitlab/gitlab-runner:alpine
ENV http_proxy=<corporate_proxy>
ENV https_proxy=<corporate_proxy>
RUN apk add vim wget curl nmap lsof bash bash-completion which
CMD ["/bin/bash"]
RUN ls -l /bin # THIS WORKS, I CAN SEE 'BASH' SHOW UP WITH 755 OWNED BY ROOT
RUN which bash # THIS ALSO WORKS
RUN /bin/bash -c "echo hi" # YES, THIS WORKS TOO
但是,当通过以下方式生成容器以使用 bash shell 时:
docker run -idt <image_name> /bin/bash,容器以FATAL: Command /bin/bash not found.启动失败
请注意,在生成容器时,这些其他选项对我来说也会失败:ash, sh, /bin/ash, /bin/sh, etc
使用--user root 运行容器也不起作用。
【问题讨论】: