构建docker映像时出现pip安装错误

时间:2018-08-12 09:59:29

标签: python docker pip centos7

我正在使用centos / python-36-centos7作为我的应用程序的基本映像。在Dockerfile中,在RUN pip install --upgrade pip之后,点值成功从9.0.1升级到18.0。下一步,在RUN pip install --no-cache-dir -r requirements.txt,码头工人不断抛出错误:

/bin/sh: /opt/app-root/bin/pip: /opt/app-root/bin/python3: bad interpreter: No such file or directory
The command '/bin/sh -c pip install --no-cache-dir -r requirements.txt' returned a non-zero code: 126
  • 操作系统:CentOS 7.2 64位
  • Docker版本:18.06.0-ce,内部版本0ffa825

完成Dockerfile

FROM centos/python-36-centos7
MAINTAINER SamYu,sam_miaoyu@foxmail.com
USER root
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
COPY . /faceDetectBaseImg
COPY ./pip.conf /etc/pip.conf
WORKDIR /faceDetectBaseImg
RUN yum install -y epel-release 
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
RUN rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro 
RUN rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
RUN yum install -y ffmpeg
RUN yum -y install libXrender
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

pip.conf

[global]
trusted-host =  mirrors.aliyun.com
index-url = https://mirrors.aliyun.com/pypi/simple

更新: 通过删除pip install --upgrade pip并运行pip 9.0.1解决了该问题。我认为这与pip 18.0 vs CentOS7 docker映像有关。我仍然想知道pip 18.0下是否有修复程序。

1 个答案:

答案 0 :(得分:0)

问题完全可以通过提取centOS7映像并从源代码构建python来解决。提醒一下,请勿使用截至2018年6月的最新版本的centos / python-36-centos7。

相关问题