首页 > 解决方案 > Windows 上的 Docker 构建未能建立新连接 Errno 11001 getaddrinfo failed

问题描述

到达此步骤时,Docker 构建失败:

运行 pip install -r requirements.txt

其他一些答案建议添加 --dns 或使用代理服务器设置,但它们都不起作用(--dns 是一个未知标志)。

所有 Docker Build 命令都会发生这种情况。我已经尝试过我的家庭网络,因为我认为我的工作网络导致了这个错误。但同样的错误结果。这个相同的构建命令在 2 周前起作用。

完整的错误测试:

C:\Users\Ghassan.Hariz\Documents\_Dev\Docker\FlaskWAHelloWorld>docker build 
-f Dockerfile -t flaskhelloworld:latest .
Sending build context to Docker daemon  4.096kB
Step 1/7 : FROM python:3.6
3.6: Pulling from library/python
3889bb8d808b: Pull complete
6631c2d2a60c: Pull complete
3e7b18583f4b: Pull complete
adf62195c93f: Pull complete
41bbc8eda457: Pull complete
9dfc9d816cb9: Pull complete
a57794da6fe5: Pull complete
f06f2d6a9853: Pull complete
25a7926ec41d: Pull complete
Digest: 
sha256:0dab923cf03b659a25b2f3e05181bddc11e2af4577537f5050db479882c7bd53
Status: Downloaded newer image for python:3.6
 ---> 0450e8af9dc3
Step 2/7 : RUN mkdir /code
 ---> Running in 75c6959f8ee9
Directory: C:\
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        8/30/2018   7:00 AM                code
Removing intermediate container 75c6959f8ee9
 ---> 419d2d14684f
Step 3/7 : WORKDIR /code
Removing intermediate container cdcdcbe7f3fa
 ---> fcdc1433a9a6
Step 4/7 : ADD . /code/
 ---> 031143926f8f
Step 5/7 : RUN pip install -r requirements.txt
 ---> Running in a3219ca48077
Collecting Flask (from -r requirements.txt (line 1))
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, 
status=None)) after connection broken by 
'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection 
object at 0x00000222AFB46908>: Failed to establish a new connection: [Errno 
11001] getaddrinfo failed',)': /simple/flask/

Retrying (Retry(total=3, connect=None, read=None, redirect=None,status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000222AFB467F0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)': /simple/flask/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000222AFB46518>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)': /simple/flask/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000222AFB46860>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)': /simple/flask/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000222AFB464E0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)': /simple/flask/

Could not find a version that satisfies the requirement Flask (from -r requirements.txt (line 1)) (from versions: )

找不到 Flask 的匹配分布(来自 -r requirements.txt(第 1 行))命令 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = '静默继续'; pip install -r requirements.txt' 返回一个非零代码:1

C:\Users\Ghassan.Hariz\Documents_Dev\Docker\FlaskWAHelloWorld>docker --version Docker 版本 18.06.1-ce,构建 e68fc7a

标签: docker

解决方案


推荐阅读