我想在pip
Ubuntu 14.04
容器中安装docker
软件包,但是由于Move Permanently
从https://pypi.python.org/simple/
返回而总是显示错误。奇怪的是,运行Ubuntu 14.04
且主机版本为python
和pip
的主机成功安装了pip
软件包。
Docker版本:
$ docker --version
Docker version 1.12.6-cs13, build 0ee24d4
Dockerfile:(注意:出于测试目的,我有意输入容器内部)。
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get -qq install python python-pip
WORKDIR /usr/src/app
COPY . .
CMD ["/bin/sh"]
在主机上:
$ uname -a
Linux duong2179-ubuntu 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ python --version
Python 2.7.6
$ pip --version
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
$ sudo pip install simplejson==3.3.1
Downloading/unpacking simplejson==3.3.1
...
Successfully installed simplejson
内部容器:
# uname -a
Linux duong2179-ubuntu 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
# python --version
Python 2.7.6
# pip --version
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
# pip install simplejson==3.3.1
Downloading/unpacking simplejson==3.3.1
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement simplejson==3.3.1
在主机上进行curl
-ing https://pypi.python.org/simple/
:
$ curl https://pypi.python.org/simple/
<html><head><title>301 Moved Permanently</title></head><body><center><h1>301 Moved Permanently</h1></center></body></html>
答案 0 :(得分:4)
这是pip 1.5.4
在使用Dockerfile
之前,将以下行添加到pip
:
RUN python -m pip install --upgrade pip