Docker连接错误“连接被NewConnectionError断开” [英] Docker connection error 'Connection broken by NewConnectionError'

查看:368
本文介绍了Docker连接错误“连接被NewConnectionError断开”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是docker的新手,我刚刚安装了它,并为django项目做了一些配置。
当我运行 docker build。 时,我遇到这些错误这是什么问题?

 警告:连接后重试(重试(总数= 4,连接=无,读取=无,重定向=无,状态=无))被'NewConnectionError('< pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f1363b604f0>破坏:无法建立新连接:[Errno -3]重试')':/ simple / django / 

Dockerfile

 从python:3.8-alpine 
MAINTAINER RAHUL VERMA

ENV PYTHONUNBUFFERED 1

COPY ./requirements.txt /requirements.txt
RUN pip install -r /requirements.txt

RUN mkdir / app
WORKDIR app
COPY ./app / app

RUN adduser- D用户
用户用户

requirements.txt文件

  Django == 2.2 
djangorestframework == 3.11.0

解决方案

我遇到了与互联网有关的问题,也可以通过以下方法进行检查:


,这几乎可以肯定是容器内部的网络/ DNS配置存在问题,与pip无关。尝试在Dockerfile中添加 RUN nslookup pypi.org 行,并查看其是否有效。如果您使用的是自定义索引网址,则将其替换为pypi.org。


https://github.com/pypa/pip/issues/7460


I am new to docker i just installed it and did some configuration for my django project. when i am running docker build . i am getting these error whats wrong here?

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 0x7f1363b604f0>: Failed to establish a new connection: [Errno -3] Try again')': /simple/django/

Dockerfile

FROM python:3.8-alpine
MAINTAINER RAHUL VERMA

ENV PYTHONUNBUFFERED 1

COPY ./requirements.txt /requirements.txt
RUN pip install -r /requirements.txt

RUN mkdir /app
WORKDIR app
COPY ./app /app

RUN adduser -D user
USER user

requirements.txt file

Django==2.2
djangorestframework==3.11.0

解决方案

I had the same problem it I solveit with the conections of internet or you can check it with this:

"This is almost certainly an issue with the networking/DNS configuration inside the container and not related to pip specifically. Try adding a RUN nslookup pypi.org line to your Dockerfile and see if it works. If you're using a custom index URL then put that instead of pypi.org."

https://github.com/pypa/pip/issues/7460

这篇关于Docker连接错误“连接被NewConnectionError断开”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆