【发布时间】:2019-03-08 07:28:50
【问题描述】:
我想用 python 和几个 centos 上的包创建一个容器。我尝试在原始 centos 容器中运行几个命令。一切正常我已经安装了我想要的一切。然后我使用通过RUN 执行的相同命令创建了Dockerfile,我得到/bin/sh: pip: command not found 有什么问题?我的意思是情况。为什么一切都可以在命令行中执行,但不能用RUN 执行?我已经尝试了这两种变体:
RUN command
RUN command
RUN pip install ...
和
RUN command\
&& command\
&& pip install ...
我执行的命令:
from centos
run yum install -y centos-release-scl\
&& yum install -y rh-python36\
&& scl enable rh-python36 bash\
&& pip install django
UPD: pip 的完整路径有所帮助。怎么了?
【问题讨论】:
-
@tgogos 我的问题更多的是关于这个问题,而不是关于这个案例。为什么命令从容器内部运行良好但不是通过
RUN -
另一种方法是在 docker hub 上启动
FROM centos/python-36-centos7