Pip安装在窗口上的Docker容器中不起作用

时间:2019-02-13 20:20:33

标签: python-3.x docker window containers dockerfile

我在窗口上使用docker。 以下是我的docker文件:

FROM microsoft/windowsservercore:latest
FROM python:3.7
RUN pip install flask
CMD ["cmd"]

当我尝试构建docker映像时,它会抛出以下异常:

>docker build  D:\HCL\Docker\

Sending build context to Docker daemon  14.34kB
Step 1/4 : FROM microsoft/windowsservercore:latest
 ---> ea9f7aa13d03
Step 2/4 : FROM python:3.7
 ---> 2137b5b81384
Step 3/4 : RUN pip install flask
 ---> Running in 7463787fcfa8

Collecting flask

  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/flask/

  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/flask/

  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/flask/

  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/flask/

  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/flask/

  Could not find a version that satisfies the requirement flask (from versions: )
No matching distribution found for flask

The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; pip install flask' returned a non-zero code: 1
  • 我已经检查了docker可以访问互联网,但是无法通过https下载任何软件包。
  • 我已检查通过http下载文件,并且工作正常。
  • 我能够在同一docker文件中安装windowcore和python。
  • 我只是遇到点子问题。
  • 我已登录到容器并手动运行pip命令,但遇到相同的错误。

0 个答案:

没有答案