[英]pip install error while building docker images
我正在使用centos / python-36-centos7作为应用程序的基本映像。 在Dockerfile
,在RUN pip install --upgrade pip
Dockerfile
RUN pip install --upgrade pip
,pip成功从9.0.1升级到18.0。 下一步,在RUN pip install --no-cache-dir -r requirements.txt
,docker继续抛出错误:
/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
完整的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下是否有修复程序。
通过从源中拉取centOS7映像并构建python可以完全解决问题。 提醒一下,截至2018年6月,请勿使用最新版本的centos / python-36-centos7。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.