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

相关推荐
中文英文-我选中文1 天前
FreeRTOS 玄学Bug:调换任务创建顺序,程序时而正常、时而死机(栈溢出内存踩踏深度复盘)
bug
Keven_111 天前
BUG:UVA116
算法·bug·图论
鬼手点金1 天前
opencode-隐私优先配置
服务器·前端·javascript·bug·openclaw
itmigrate3 天前
异步请求竞态,藏在页面渲染里的隐形bug
bug
Escalating_xu3 天前
【Python】使用库:标准库、第三方库、pip、项目实战与程序打包
java·python·pip
今夕资源网4 天前
OmniVoice 今夕整合包 本地语音TTS断网可用 修复了一些BUG 优化生成速度 极速秒生成
bug·语音克隆·omnivoice·断网可用·本地语音tts·语音tts
青春不朽5125 天前
pip 安装慢、超时、报错?一份国内源配置 + 9 个高频报错对照表
pip
ysu_03146 天前
uv实战指南-从Python版本虚拟环境到pyproject依赖管理
开发语言·python·pip·uv·虚拟环境·包管理·依赖管理
烧烧的酒0.o8 天前
Codex桌面版更新后不能使用最新模型问题-排查修复总结
chatgpt·bug