我有一个 Windows Server 2016 Box,我想用它来构建部署 Python Flask 应用程序的 Docker EE Windows 容器。
我尝试在没有代理环境变量的情况下进行构建。我试过设置代理环境变量(我可能做错了,我使用了带有 Flask 分配端口的服务器 IP 地址。)
我也试过只在 dockerfile 中安装一个包而不是 require.txt 文件,但没有成功。
我不相信 Windows Box 有代理设置,因为我运行:netsh winhttp show proxy
并且它说 Direct access (no proxy server).
我尝试重新启动 docker 服务并尝试使用 --network=host
进行构建。我读过尝试将 DNS 服务器设置为 8.8.8.8 可能值得,但我不确定在哪里设置它。任何人都可以提供您的经验吗?
请记住,我可以成功运行此程序:docker run hello-world:nanoserver-sac2016
这里是 docker 文件:
FROM python:3.8
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
COPY . .
ENTRYPOINT ["python"]
CMD ["wsgi.py"]
EXPOSE 8000
这里是错误:
PS C:\Users\administrator.user1\Desktop\FlaskReportAppDev> docker build -t myflaskapp .
Sending build context to Docker daemon 252.7MB
Step 1/8 : FROM python:3.8
---> d070676dfed8
Step 2/8 : WORKDIR /app
---> Using cache
---> f02733df8e5f
Step 3/8 : COPY . .
---> ef40674fc745
Step 4/8 : RUN pip install -r requirements.txt
---> Running in 6c984bec9495
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000021B39F42F
D0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/click/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000021B39ED33
70>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/click/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000021B3831A2
20>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/click/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000021B39EECA
90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/click/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000021B39F4D4
F0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/click/
ERROR: Could not find a version that satisfies the requirement click==7.1.1 (from versions: none)
ERROR: No matching distribution found for click==7.1.1
The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; pip install -r requirements.txt' returned a non-zero code: 1