解决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

相关推荐
加强洁西卡12 分钟前
【Bug】解决vscode里ssh连接的虚拟机的codex的侧边栏打开只有logo没有登录或输入框的问题
bug
不懂的浪漫19 小时前
Codex 更新后历史 Session 消失?我写了一个修复官方 Bug 的 Recovery Skill
bug·codex·skill
এ慕ོ冬℘゜20 小时前
手写一款高兼容、零BUG图片预览组件|前端
前端·bug
hui函数2 天前
Python系列Bug修复|如何解决 pip install 报错 ModuleNotFoundError: No module named ‘pygame’ 问题
python·bug·pip
初圣魔门首席弟子2 天前
BUG-001: 相对导入超出顶级包范围导致程序启动失败
bug
bbaydnog2 天前
FreeRTOS学习笔记 17:资源管理与临界区保护——优先级反转、死锁,90%的RTOS bug都跟它有关
笔记·学习·bug
lili00123 天前
Claude自动修Bug配置优化与避坑指南
java·人工智能·python·bug·ai编程
白日与明月3 天前
pip下载库指定操作系统及python版本
开发语言·python·pip
巡山小钻风来也4 天前
FilterPy——工具库‌离线源码安装教程
python·pip
小陶来咯4 天前
agent × 豆包:端到端语音实时交互
网络·ai·机器人·bug·交互