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

相关推荐
钱栈up12 小时前
坯料管理导入功能bug修复:只改前端一个文件就解决问题
前端·bug
项目管理实用笔记13 小时前
Bug跟踪管理系统有哪些?2026 推荐清单与选型指南
bug·研发管理·研发管理工具·项目管理软件选型
王_teacher2 天前
pycharm 无法将“pip”项识别为 cmdlet、函数、脚本文件或可运行程序的名称
pycharm·pip·pycharm配置·无法将“pip”项识别·无法将pip项识别
iNeuOS工业互联网4 天前
iNeuOS工业互联网操作系统,重要更新:性能优化、安全漏洞与BUG修复,远程控制响应效率大幅提升
性能优化·bug
嵌入式学习菌5 天前
Modbus‑RTU 数据类型分析
开发语言·单片机·bug
缘友一世5 天前
dsh(0.1.5-rc.1)接入官方模型deepseek-flash图像输入不支持修复
bug·图片输入·deepseek-flash·dsh 0.1.5-rc.1
lovingsoft5 天前
AI测试中的对抗测试:从“找Bug”到“预演战争”
人工智能·bug
zhangzeyuaaa7 天前
深入理解 pip install .:安装当前目录项目的正确姿势
人工智能·python·pip
golang学习记7 天前
VS Code 新UI被曝重大bug:菜单栏消失了
vscode·bug
j7~7 天前
【软件测试】(概念篇)《需求的概念,测试用例(case),软件错误(bug),开发模型以及测试模型》---详解
软件测试·bug·敏捷模型·开发模型·测试模型·测试中需求的定义·软件的生命周期