进行此步骤时,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 ='SilentlyContinue'; pip install -r requirements.txt'返回的非零代码:1
C:\ Users \ Ghassan.Hariz \ Documents_Dev \ Docker \ FlaskWAHelloWorld> docker --version Docker版本18.06.1-ce,内部版本e68fc7a
答案 0 :(得分:-3)
更改容器。
切换到linux容器