作为学习django的一部分,我正在构建我的第一个docker安装。我的docker安装工作正常。docker信息正常。hello-world显示成功。但是当我运行Will Vincent在我的Django 3.0 Pro Book中的tourorial建议的Docker文件时,我得到了一个看起来像网络DNS错误的东西。
################# 错误:
Step 6/7 : RUN pip install pipenv && pipenv install --system
---> Running in 585e5020f53a
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 0x7f339144df10>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pipenv/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3391f05a90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pipenv/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3391f05e90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pipenv/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3391f05ad0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pipenv/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f33915ddd90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pipenv/
ERROR: Could not find a version that satisfies the requirement pipenv (from versions: none)
ERROR: No matching distribution found for pipenv
The command '/bin/sh -c pip install pipenv && pipenv install --system' returned a non-zero code: 1
####################
尝试构建停靠文件:
提取基本图像
FROM python:3.7
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set work directory
WORKDIR /code
# Install dependencies
COPY Pipfile Pipfile.lock /code/
RUN pip install pipenv && pipenv install --system
# Copy project
COPY . /code/
RUN pip install ....行出现故障。
我已经添加了DNS名称服务器条目直接到我的/etc/resolver. conf文件中,因为其他人在我的搜索这里建议。不工作。
我假设Docker试图在容器中运行PIP时出现了一些问题??这是我第一次安装Docker,所以用尽了搜索答案。
在操作系统版本Centos8上
谢谢比尔·桑德森
2条答案
按热度按时间gmxoilav1#
好吧,我们可以尝试几件事。我会做的第一件事:
RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf && pip install pipenv && pipenv install --system
在同一个RUN命令中执行此操作非常重要。
docker build --network=host -t yourimage:yourversion .
g6ll5ycj2#
我昨晚和今天早上都遇到了同样的问题。甚至在重新启动并试图停止/启动服务之后。这是在我的Windows 10上。
我确实注意到运行
docker info
输出时出现以下错误:如此处所述-https://stackoverflow.com/a/74098179/405022
运行了
wsl --shutdown
并被提示重新启动docker桌面后,我继续尝试我的docker构建。巧合?最后我成功了。