docker报错WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) afte

完整报错

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f1fddb10d00>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/

同一个dockerfile,在腾讯云CentOS7.9,python3.9.7(Miniconda环境),报错,当然这个docker里面它自己用的python3.8;在虚拟机CentOS7.9,python3.9.5(Miniconda默认base环境),正常编译安装。

一开始以为是dockerfile中指定的pypi源,腾讯云连不上,就在dockerfile中改为清华源,结果还是报错。然后直接在终端执行dockerfile中那些安装python库的代码(即图中第六步的代码),不用docker,都可以正常安装。

然后查到Temporary failure in name resolution 错误 - 云+社区 - 腾讯云 (tencent.com),再给腾讯云添加nameserver 114.114.114.114,不行;hosts我这不用改,跟它的一样。

又查到server - Python pip raising NewConnectionError while installing libraries - Stack Overflow,和上面那个链接中的方法类似,就没试。

最后查到python - Temporary failure in name resolution [Errno -3] with Docker - Stack Overflow,说执行sudo service docker restart就好了,重启docker后果然好了。

猜你喜欢

转载自blog.csdn.net/fj_changing/article/details/122934353