我正在尝试Docker构建django应用,但是当docker尝试pip install -r要求时,我收到以下消息:
Collecting Django==2.2.5 (from -r requirements.txt (line 1) WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ff789506828>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/django/
有我的Dockerfile:
FROM python:3.6
ENV PYTHONUNBUFFERED 1
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
我的Linux发行版:
Linux version 4.15.0-30deepin-generic (pbuilder@zs-PC) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)) #31 SMP Fri Nov 30 04:29:02 UTC 2018
不仅是Django,而且无法安装所有要求。我没有使用代理
答案 0 :(得分:0)
在构建期间可能缺少网络访问权限。试试:
docker build --network=host .
答案 1 :(得分:0)
我遇到了同样的问题,就我而言,我已连接到 VPN 服务器,从 VPN 客户端断开连接解决了问题。