在 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 有关系?
1
iwishing 2016-07-10 19:13:22 +08:00
docker 装没问题啊
root@ubuntudev:~/test# docker build . Sending build context to Docker daemon 3.072 kB Step 1 : FROM python:3.5 ---> cf9db56faafa Step 2 : ENV PYTHONUNBUFFERED 1 ---> Using cache ---> 59337f3b0849 Step 3 : RUN mkdir /usr/src/app ---> Using cache ---> d8b5fcadfd9f Step 4 : RUN mkdir /usr/log ---> Using cache ---> d5af0c84406e Step 5 : WORKDIR /usr/src/app ---> Using cache ---> 43813190de59 Step 6 : ADD . /usr/src/app ---> 7b9ab61b6512 Removing intermediate container d3a9f1b4eebf Step 7 : RUN pip install -r requirements.txt ---> Running in 5e174f556631 Collecting Django==1.8.13 (from -r requirements.txt (line 1)) Downloading Django-1.8.13-py2.py3-none-any.whl (6.2MB) Installing collected packages: Django Successfully installed Django-1.8.13 ---> a405a0263b58 Removing intermediate container 5e174f556631 Successfully built a405a0263b58 |
3
kkzxak47 OP 其实是内存不足,进程被杀了,这个出错信息也是有意思哈
|