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

docker拉取失败,更换docker的源

docker pull hello-world时报错
hh@hh-virtual-machine:~$ docker pull hello-world
Using default tag: latest
Error response from daemon: Get "https://registry-1.docker.io/v2/": context deadline exceededhh@hh-virtual-machine:~$ docker pull registry.cn-hangzhou.aliyuncs.com/library/ubuntu:22.04
Error response from daemon: pull access denied for registry.cn-hangzhou.aliyuncs.com/library/ubuntu, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

这个错误表明Docker客户端尝试访问Docker Hub或其他Docker注册中心时出现了问题。具体来说,是在尝试获取注册中心API的响应时遇到了错误。可能的原因包括网络问题、认证问题、注册中心URL不正确或者注册中心服务本身不可用。

2、解决方法
2.1 检查网络

hh@hh-virtual-machine:~$ ping www.baidu.com
PING www.wshifen.com (119.63.197.151) 56(84) bytes of data.
64 bytes from 119.63.197.151 (119.63.197.151): icmp_seq=1 ttl=49 time=161 ms
64 bytes from 119.63.197.151 (119.63.197.151): icmp_seq=2 ttl=49 time=164 ms
64 bytes from 119.63.197.151 (119.63.197.151): icmp_seq=3 ttl=49 time=160 ms
^C
--- www.wshifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 160.431/161.615/163.762/1.520 ms

2.2检查docker状态

hh@hh-virtual-machine:~$ systemctl status docker
● docker.service - Docker Application Container EngineLoaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)Active: active (running) since Fri 2025-11-07 14:02:48 CST; 17min ago
TriggeredBy: ● docker.socketDocs: https://docs.docker.comMain PID: 1335 (dockerd)Tasks: 16Memory: 122.3MCPU: 1.526sCGroup: /system.slice/docker.service└─1335 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock1107 14:18:15 hh-virtual-machine dockerd[1335]: time="2025-11-07T14:18:15.098431463+08:00" level=error msg="Handler for POST /v1.51/images/create returned error: Get \"https://hub-mirror.c.163.com/v2/\": dial tcp: lookup hub-mirror.c.163.com on 127>
1107 14:18:36 hh-virtual-machine dockerd[1335]: time="2025-11-07T14:18:36.217686088+08:00" level=warning msg="Error getting v2 registry: Get \"https://docker.mirrors.ustc.edu.cn/v2/\": dial tcp: lookup docker.mirrors.ustc.edu.cn on 127.0.0.53:53: n>
1107 14:18:36 hh-virtual-machine dockerd[1335]: time="2025-11-07T14:18:36.217749899+08:00" level=info msg="Attempting next endpoint for pull after error: Get \"https://docker.mirrors.ustc.edu.cn/v2/\": dial tcp: lookup docker.mirrors.ustc.edu.cn on>
1107 14:18:36 hh-virtual-machine dockerd[1335]: time="2025-11-07T14:18:36.269239801+08:00" level=warning msg="Error getting v2 registry: Get \"https://hub-mirror.c.163.com/v2/\": dial tcp: lookup hub-mirror.c.163.com on 127.0.0.53:53: no such host"
1107 14:18:36 hh-virtual-machine dockerd[1335]: time="2025-11-07T14:18:36.269318729+08:00" level=info msg="Attempting next endpoint for pull after error: Get \"https://hub-mirror.c.163.com/v2/\": dial tcp: lookup hub-mirror.c.163.com on 127.0.0.53:>
1107 14:18:51 hh-virtual-machine dockerd[1335]: time="2025-11-07T14:18:51.271108112+08:00" level=warning msg="Error getting v2 registry: Get \"https://registry.docker-cn.com/v2/\": net/http: request canceled while waiting for connection (Client.Tim>
1107 14:18:51 hh-virtual-machine dockerd[1335]: time="2025-11-07T14:18:51.271180286+08:00" level=info msg="Attempting next endpoint for pull after error: Get \"https://registry.docker-cn.com/v2/\": net/http: request canceled while waiting for conne>
1107 14:19:06 hh-virtual-machine dockerd[1335]: time="2025-11-07T14:19:06.271769052+08:00" level=warning msg="Error getting v2 registry: Get \"https://registry-1.docker.io/v2/\": context deadline exceeded"
1107 14:19:06 hh-virtual-machine dockerd[1335]: time="2025-11-07T14:19:06.271862946+08:00" level=info msg="Attempting next endpoint for pull after error: Get \"https://registry-1.docker.io/v2/\": context deadline exceeded"
1107 14:19:06 hh-virtual-machine dockerd[1335]: time="2025-11-07T14:19:06.273537816+08:00" level=error msg="Handler for POST /v1.51/images/create returned error: Get \"https://registry-1.docker.io/v2/\": context deadline exceeded"

2.3 更换源

systemctl status docker
sudo mkdir -p /etc/docker
vim /etc/docker/daemon.json  
添加:
{"registry-mirrors" : ["https://docker.registry.cyou",
"https://docker-cf.registry.cyou",
"https://dockercf.jsdelivr.fyi",
"https://docker.jsdelivr.fyi",
"https://dockertest.jsdelivr.fyi",
"https://mirror.aliyuncs.com",
"https://dockerproxy.com",
"https://mirror.baidubce.com",
"https://docker.m.daocloud.io",
"https://docker.nju.edu.cn",
"https://docker.mirrors.sjtug.sjtu.edu.cn",
"https://docker.mirrors.ustc.edu.cn",
"https://mirror.iscas.ac.cn",
"https://docker.rainbond.cc",
"https://do.nark.eu.org",
"https://dc.j8.work",
"https://dockerproxy.com",
"https://gst6rzl9.mirror.aliyuncs.com",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"http://mirrors.ustc.edu.cn/",
"https://mirrors.tuna.tsinghua.edu.cn/",
"http://mirrors.sohu.com/"  
],"insecure-registries" : ["registry.docker-cn.com","docker.mirrors.ustc.edu.cn"],
"debug": true,
"experimental": false
}

2.4 重载和重启dockers服务

sudo systemctl daemon-reload
sudo systemctl restart docker
docker info

2.5重新执行
docker pull hello-world

http://www.dtcms.com/a/582911.html

相关文章:

  • asp网站验证码不显示莱州网络推广公司
  • Android Gralde补全计划 productFlavors多渠道打包(变体/多客户)
  • 网站建设多少钱网站开发项目经理职责
  • 浙江腾鑫建设集团网站手机如何打开wordpress
  • 算法 day 47 单调栈
  • 一个静态网站开发考虑什么绍兴建设局网站首页
  • 做网站练手项目广东新闻联播回看
  • JavaEE初阶——多线程(8)JUC的常见类
  • 全参数DeepSeek(671B)企业部署方案
  • 柳州网站开发网上申请店铺开网店的流程
  • Java与Swift完整语法对比手册
  • 网站系统环境的搭建微信公众平台小程序二维码怎么生成
  • 做吉祥物设计看什么网站wordpress 开头空格
  • dockerfile一个引号缺失带来的惨案
  • 做电子板报的网站wordpress 汽车租赁
  • 英文网站设计公司建网站的过程
  • 虚拟网站php专业型网站开发服务费会计处理
  • 东莞大朗网站建设公司怎么查看网站死链接
  • 站多多 福州网站建设益阳建设网站
  • 中科数测研究院议题入选Biohacking Village Labs,即将亮相东京CodeBlue大会
  • SpringCloud微服务保护与分布式事务知识点总结
  • Kubernetes脉络:从基础概念到核心架构的认知框架
  • Ascend C核函数执行全流程深潜:从rtKernelLaunch到硬件执行的完整解密
  • 海澜之家的网站建设目标中文官网资源
  • 食品 网站源码外贸出口公司网站建设方案
  • 沈阳建网站如何建设企业人力资源网站
  • 精准计算,终结经验主义:钢丝绳智能选型重塑吊装安全
  • 汽车智能驾驶 超声波雷达、毫米波雷达和激光雷达
  • 网站开发所需要的条件icp备案号是什么意思
  • 幂数加密(攻防世界)