我正在尝试构建一个包含pip的docker容器。
我在CentOS 7上。
这是运行docker build命令的片段:
Step 3 : RUN yum -y install python-pip
---> Running in 25d1ba46e6dc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.vcu.edu
* extras: mirror.clarkson.edu
* updates: mirrors.unifiedlayer.com
No package python-pip available.
Error: Nothing to do
2015/02/13 19:23:48 The command [/bin/sh -c yum -y install python-pip] returned a non-zero code: 1
我会发布我的Dockerfile,但是似乎标准CentOS发行版中没有python-pip,因为这也失败了:
sudo yum -y install python-pip
[sudo] password for theuser:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.thelinuxfix.com
* extras: mirrors.xmission.com
* updates: mirrors.tripadvisor.com
No package python-pip available.
Error: Nothing to do
有用于解决主机系统安装问题的链接:http : //www.liquidweb.com/kb/how-to-install-pip-on-centos-7/涉及使用rpm或curl。我认为这对Docker有点混乱。
另外,如果CentOS从标准发行版中删除了pip,也许他们有充分的理由,我不应该使用蛮力来安装它。
在Ubuntu或其他发行版中,这似乎不是问题。只是CentOS 7。
我的简洁问题是:在CentOS 7中安装pip(或替代方法)的首选方法是什么?
在Dockerfile中使用它可以安装pip:
RUN yum -y install epel-release && yum clean all
RUN yum -y install python-pip && yum clean all
这似乎比使用rpm或curl更干净。
如果仍然失败,请尝试:
RUN yum -y install --enablerepo="epel" python-pip && yum clean all
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句