docker拉取失敗,更換docker的源方式
docker拉取失敗,更換docker的源
docker pull hello-world時(shí)報(bào)錯(cuò) 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 exceeded hh@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
這個(gè)錯(cuò)誤表明Docker客戶端嘗試訪問Docker Hub或其他Docker注冊(cè)中心時(shí)出現(xiàn)了問題。
具體來說,是在嘗試獲取注冊(cè)中心API的響應(yīng)時(shí)遇到了錯(cuò)誤。
可能的原因包括網(wǎng)絡(luò)問題、認(rèn)證問題、注冊(cè)中心URL不正確或者注冊(cè)中心服務(wù)本身不可用。
解決方法
檢查網(wǎng)絡(luò)
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
檢查docker狀態(tài)
hh@hh-virtual-machine:~$ systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: 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.socket
Docs: https://docs.docker.com
Main PID: 1335 (dockerd)
Tasks: 16
Memory: 122.3M
CPU: 1.526s
CGroup: /system.slice/docker.service
└─1335 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
11月 07 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>
11月 07 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>
11月 07 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>
11月 07 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"
11月 07 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:>
11月 07 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>
11月 07 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>
11月 07 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"
11月 07 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"
11月 07 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"
更換源
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
}
重載和重啟dockers服務(wù)
sudo systemctl daemon-reload sudo systemctl restart docker docker info
重新執(zhí)行
docker pull hello-world
總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Linux執(zhí)行Docker命令提示Get Permission Denied的解決方案
這篇文章主要介紹了Linux執(zhí)行Docker命令提示Get Permission Denied的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2025-06-06
win10子系統(tǒng)ubuntu(WSL) 安裝Docker的教程(圖文詳解)
現(xiàn)在 Docker 有專門的 Win10 專業(yè)版系統(tǒng)的安裝包,需要開啟Hyper-V,具體開啟方法文中給大家介紹的很詳細(xì),這篇文章主要介紹了win10子系統(tǒng)ubuntu(WSL) 安裝Docker,需要的朋友可以參考下2019-10-10
milvus向量數(shù)據(jù)庫(kù)用法及部署(docker-compose)
Milvus是一個(gè)開源的向量數(shù)據(jù)庫(kù),專為存儲(chǔ)和檢索高維向量數(shù)據(jù)設(shè)計(jì),支持多種索引算法和混合查詢能力,它廣泛應(yīng)用于實(shí)時(shí)推薦系統(tǒng)、圖像/視頻檢索、生物信息學(xué)、自然語言處理和多模態(tài)檢索等領(lǐng)域,部署環(huán)境包括etcd、minio和attu等組件,通過docker-compose進(jìn)行管理2026-02-02

