在ubuntu上的runnung dockerfile中django安装失败

时间:2017-10-04 17:51:40

标签: python django ubuntu docker

问候语,

我在https://docs.docker.com/compose/django/使用我的Docker环境在CentOS VM和Ubuntu VM中跟踪了docker撰写quickstart示例。该示例适用于CentOS,但不适用于Ubuntu。失败发生在

RUN pip install -r requirements.txt

错误是

Step 6/7 : RUN pip install -r requirements.txt
 ---> Running in 7ed9830cea5f
Collecting Django (from -r requirements.txt (line 1))
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fe12ff70470>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/django/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fe12ff70438>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/django/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fe12ff706a0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/django/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fe12f4fe5f8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/django/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fe12f4fea58>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/django/
  Could not find a version that satisfies the requirement Django (from -r requirements.txt (line 1)) (from versions: )
No matching distribution found for Django (from -r requirements.txt (line 1))

你能不能帮助我解决这个问题,并理解为什么会在Ubuntu中发生这种情况,而不是在CentOS中呢?

...谢谢

2 个答案:

答案 0 :(得分:1)

事实证明我的/etc/resolv.conf指向了错误的名称服务器。我仍然需要调查为什么会这样。如果手动输入正确的DNS,则docker容器具有网络。

答案 1 :(得分:0)

运行pip搜索并确保您所寻找的内容。从错误看起来它实际上找不到它。

Docker文档往往在主站点上过时。