在 digitalocean sfo 机房的 ubuntu14.04 上配 docker 里的 django ,在系统里直接安装没任何问题:
pip install Django==1.8.13 --no-cache-dir --ignore-installed
Collecting Django==1.8.13
Downloading Django-1.8.13-py2.py3-none-any.whl (6.2MB)
100% |################################| 6.2MB 6.8MB/s
Installing collected packages: Django
Successfully installed Django-1.8.13
但是 docker 就不行了:
Step 6 : RUN pip install -r requirements.txt
---> Running in 6d2f65927b6f
Collecting Django==1.8.13 (from -r requirements.txt (line 1))
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x7fe9e3085f28>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/django/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x7fe9e3085898>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/django/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x7fe9e30858d0>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/django/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x7fe9e30851d0>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/django/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x7fe9e47c8160>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/django/
Could not find a version that satisfies the requirement Django==1.8.13 (from -r requirements.txt (line 1)) (from versions: )
No matching distribution found for Django==1.8.13 (from -r requirements.txt (line 1))
ERROR: Service 'web' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Dockerfile 是这样:
FROM python:3.5
ENV PYTHONUNBUFFERED 1
RUN mkdir /usr/src/app
RUN mkdir /usr/log
WORKDIR /usr/src/app
ADD . /usr/src/app
RUN pip install -r requirements.txt
可能是什么地方的问题,是不是跟 python3.5 更新到 3.5.2 有关系?
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.