解决dockerfile创建镜像时pip install报错的bug

项目场景:

使用docker-compose创建django容器


问题描述

python 复制代码
 > [5/5] RUN /bin/bash -c 'source ~/.bashrc && python3 -m pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple':              
0.954 Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple                                                                                   
15.98 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 0x7fefee58f1d0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/aliyun-python-sdk-core/                                                                                                                        
31.50 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fefea3e8d10>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/aliyun-python-sdk-core/
47.53 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fefea3e9710>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/aliyun-python-sdk-core/
64.55 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fefea3e9f50>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/aliyun-python-sdk-core/
83.57 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fefea3ea8d0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/aliyun-python-sdk-core/
98.59 ERROR: Could not find a version that satisfies the requirement aliyun-python-sdk-core (from versions: none)
98.59 ERROR: No matching distribution found for aliyun-python-sdk-core
113.6 WARNING: There was an error checking the latest version of pip.

解决dockerfile创建镜像时pip install报错的bug


解决方案:

执行service docker restart

相关推荐
残花月伴14 小时前
天机学堂——day1(修改bug)
servlet·bug
std860211 天前
微软 Win11 经典版 Outlook 曝 BUG,加速 SSD 损耗
microsoft·bug·outlook
花花鱼1 天前
android 网络访问拦截器使用后的bug处理
bug
JH30731 天前
MyBatis多表联查返回List仅一条数据?主键冲突BUG排查与解决
bug·mybatis
约翰先森不喝酒2 天前
Android BUG 之 资源文件报红但不影响运行
bug
百花~2 天前
认识BUG~
bug
ZHE|张恒2 天前
RDP 远程桌面连接:浏览器无法获取摄像头
bug
chde2Wang2 天前
Linux中bash: ls: 未找到命令… 相似命令是: ‘lz‘
linux·运维·bug·bash
阿里巴巴淘系技术团队官网博客2 天前
让AI打出丝滑连招:编码-部署-自测-改bug
人工智能·bug
lsswear2 天前
colinmollenhour/credis 1.17 bug
bug