我正在尝试构建一个包含requirements.txt 文件的docker 镜像,但在运行构建时无法安装依赖项。
这是 docker 文件内容: 来自 tiangolo/uwsgi-nginx-flask:flask
> # copy over our requirements.txt file COPY requirements.txt /tmp/
>
> # upgrade pip and install required python packages RUN apt-get update pip install -U pip RUN apt-get update pip install -r
> /tmp/requirements.txt
>
> # copy over our app code COPY ./app /app
需求.txt:
Flask==0.12.2
pyfiglet==0.7.5
这是出现的错误:
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb04e93a950>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/pip/
但是当我以 pip installrequirements.txt
的形式运行需求时,它工作正常。
我做错了什么吗?谁能帮我吗?
最佳答案
我的防火墙阻止了连接。现在工作正常。
关于python - 构建docker镜像时无法运行requirements.txt文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44462400/