把python-pip放在CentOS的docker镜像上?

我想要一个有pip的Docker镜像,然后在Dockerfile中使用pip来安装Python需求。

现在,我的Dockerfile看起来像这样:

FROM centos # Set the working directory to /app WORKDIR /app # Copy the current directory contents into the container at /app ADD . /app # Set up pip RUN rm -f /var/lib/rpm/__* RUN rpm --rebuilddb -v -v RUN yum -y install epel-release && yum clean all RUN yum -y install python-pip && yum clean all #RUN yum --enablerepo=extras install epel-release #RUN yum -y install python-pip # Install any needed packages for Python specified in requirements.txt RUN pip install -r requirements.txt CMD ["python", "./app.py"] 

这给挂在以下消息:

 Step 7/9 : RUN yum -y install python-pip && yum clean all ---> Running in 02ae6c729ab8 Loaded plugins: fastestmirror, ovl ftp://ftp.ussg.iu.edu/linux/centos/7.4.1708/os/x86_64/repodata/9346184be1deb727caf4b1ecf4a7949155da5da74af9b92c172687b290a773df-c7-x86_64-comps.xml.gz: [Errno 12] Timeout on ftp://ftp.ussg.iu.edu/linux/centos/7.4.1708/os/x86_64/repodata/9346184be1deb727caf4b1ecf4a7949155da5da74af9b92c172687b290a773df-c7-x86_64-comps.xml.gz: (28, '') Trying other mirror. 

注释掉“RUN rm -f / var / lib / rpm / __ *”和“RUN rpm –rebuilddb -v -v”会导致类似的消息,并在尝试执行第一次yum安装时挂起。

Interesting Posts