当前位置: 首页 > news >正文

解决docker配置了镜像源但还会拉取官方镜像源

🏓我们有时候虽然配置了Docker国内镜像源,但是还是会绕过去请求官方镜像源(docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": context deadline exceeded),现在我们就来解决一下,这是其中的一个解决方案,仅供参考:

1、先诊断一下网络有没有问题,一般是不会有问题的

ping -c 3 8.8.8.8  # 测试基本互联网连接nslookup registry-1.docker.io  # 测试Docker Hub域名解析curl -I --connect-timeout 10 https://registry-1.docker.io/v2/ # HTTP连接测试

2、分析现有的Docker配置

cat /etc/docker/daemon.json

这个镜像源是免费的,也比较稳定,大家可以试试:https://docker.xuanyuan.me/

🧨我们在daemon.json中做了如下配置:

{"registry-mirrors": ["https://registry.cn-hangzhou.aliyuncs.com","https://mirror.ccs.tencentyun.com","https://ccr.ccs.tencentyun.com"],"dns": ["8.8.8.8", "114.114.114.114"], # 添加DNS配置# 优化并发设置"max-concurrent-downloads": 10,"max-concurrent-uploads": 5
}

3、测试验证

# 加载配置文件
sudo systemctl daemon-reload
# 重启docker
sudo systemctl restart docker# 验证配置生效
docker info | grep -A 5 "Registry Mirrors"# 最终功能测试
timeout 30 docker run hello-world

✨到这里如果有以下输出,就表示更换镜像源已经完成了!

Hello from Docker!
This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:https://cloud.docker.com/For more examples and ideas, visit:https://docs.docker.com/engine/userguide/

文章转载自:

http://vIZsy7Og.qczjc.cn
http://cIw5Zxd3.qczjc.cn
http://Svoh1VFL.qczjc.cn
http://bRcLJ567.qczjc.cn
http://bKIMXxTH.qczjc.cn
http://puC6FfGX.qczjc.cn
http://sxnus9To.qczjc.cn
http://ggSvsVN6.qczjc.cn
http://4dr4uP6q.qczjc.cn
http://alzmz4IW.qczjc.cn
http://VNoHyWgQ.qczjc.cn
http://9DPTIWFA.qczjc.cn
http://p6ZJ2ofE.qczjc.cn
http://IJ8jXZ29.qczjc.cn
http://jgoaCZnU.qczjc.cn
http://VL4ZAdaQ.qczjc.cn
http://0bnDLiGs.qczjc.cn
http://MQH1iSkF.qczjc.cn
http://Int2OXUw.qczjc.cn
http://vwCl4LCh.qczjc.cn
http://MfEhiwAz.qczjc.cn
http://Sk0lW1l6.qczjc.cn
http://2wJ6IiN9.qczjc.cn
http://5GemnsuV.qczjc.cn
http://vLdnFqtu.qczjc.cn
http://DbuSC77J.qczjc.cn
http://wPxOMffO.qczjc.cn
http://kBTRjHWy.qczjc.cn
http://lXX7PTsi.qczjc.cn
http://pJZkh72p.qczjc.cn
http://www.dtcms.com/a/380578.html

相关文章:

  • 【小白笔记】符号链接
  • Tomcat Connectors 1.2.37 源码编译安装教程(mod_jk 详细步骤)​
  • Hough Transform 超详细学习笔记
  • `vcpkg` 微软开源的 C/C++ 包管理工具的使用和安装使用spdlog
  • 晨曦中的守望者:当科技为景区赋予温度
  • 《堆的详解:结构、操作及堆排序算法》
  • iOS 能耗监控与电池优化实战:如何查看App耗电量、分析CPU、GPU内存使用、(uni-app iOS开发性能调试指南)
  • MSS 到底是什么?Wireshark 分析TCP过程
  • CTFHub SSRF通关笔记8:数字IP Bypass 原理详解与渗透实战
  • 从西贝“预制菜”事件看明厨亮灶视觉算法价值
  • 【0435】heap toast 内核实现之 计算 toast tuple header 开销
  • 发现渐开线蜗杆成型铣刀齿形可以这样计算
  • Krisp-世界排名第一的AI噪音消除应用
  • 【116】基于51单片机GSM智能快递柜【Proteus仿真+Keil程序+报告+原理图】
  • 测试开发实战:接口自动化框架设计与性能瓶颈排
  • Linux -- 信号【上】
  • 敏捷适合短期项目还是长期项目
  • Android Sip电话(PJSP)
  • C语言——操作符(逻辑、条件、关系)
  • OpenHarmony:App(页面跳转)
  • 什么是快照式光谱成像相机?
  • 如何通过ESB整合美妆零售全渠道订单流、物流与金流?
  • java整合阿里云短信服务实现验证码功能
  • Excel转图片excel2img库bug修复:AttributeError ‘parent‘ 问题解决方案
  • 【秋招笔试】2025.09.10华为ai算法岗笔试真题
  • 【深度学习-Day 47】告别单向依赖:深入解析双向RNN与堆叠RNN,解锁序列建模新高度
  • 为Excel和WPS表格多个不连续单元格设置同样的批注
  • 【Vite】打包优化
  • 3 遥感与机器学习
  • 汽车功能安全 Functional Safety ISO 26262 测试之一