跳到主要内容

配置镜像源

网络现状

无法连接Docker仓库(registry)

ubuntu@HomeLab:~$ docker search nginx
Error response from daemon: Get "https://index.docker.io/v1/search?q=nginx&n=25": dial tcp [2a03:2880:f112:83:face:b00c:0:25de]:443: i/o timeout

ubuntu@HomeLab:~$ docker pull nginx
Using default tag: latest
Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

想要使用Docker需要配置镜像源。

提示

1panel 和 fnos 通常会替用户配置好镜像源。

配置镜像

#一键配置镜像。注意:会覆盖原配置。
sudo sh -c 'echo "{\"registry-mirrors\": [\"https://docker.1ms.run\"]}" > /etc/docker/daemon.json'

#查看配置
ubuntu@HomeLab:~$ cat /etc/docker/daemon.json
{"registry-mirrors": ["https://docker.1ms.run"]}

#重启docker服务
sudo systemctl restart docker

地址列表:

"https://dockerpull.org",
"https://docker.1panel.dev",
"https://docker.foreverlink.love",
"https://docker.fxxk.dedyn.io",
"https://docker.xn--6oq72ry9d5zx.cn",
"https://docker.zhai.cm",
"https://docker.5z5f.com",
"https://a.ussh.net",
"https://docker.cloudlayer.icu",
"https://hub.littlediary.cn",
"https://hub.crdz.gq",
"https://docker.unsee.tech",
"https://docker.kejilion.pro",
"https://registry.dockermirror.com",
"https://hub.rat.dev",
"https://dhub.kubesre.xyz",
"https://docker.nastool.de",
"https://docker.udayun.com",
"https://docker.rainbond.cc",
"https://hub.geekery.cn",
"https://docker.1panelproxy.com",
"https://atomhub.openatom.cn",
"https://docker.m.daocloud.io",
"https://docker.1ms.run",
"https://docker.linkedbus.com",
"https://dytt.online",
"https://func.ink",
"https://lispy.org",
"https://docker.xiaogenban1993.com"

地址来源:github上的一个项目,请自行辨别是否可信。

https://github.com/dongyubin/DockerHub

效果测试

docker search 不可用,docker pull 可用,docker push 未测试也不建议使用。

ubuntu@HomeLab:~$ docker search nginx
Error response from daemon: Get "https://index.docker.io/v1/search?q=nginx&n=25": dial tcp [2a03:2880:f131:83:face:b00c:0:25de]:443: i/o timeout


ubuntu@HomeLab:~$ docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
c29f5b76f736: Pull complete
e19db8451adb: Pull complete
24ff42a0d907: Pull complete
c558df217949: Pull complete
976e8f6b25dd: Pull complete
6c78b0ba1a32: Pull complete
84cade77a831: Pull complete
Digest: sha256:91734281c0ebfc6f1aea979cffeed5079cfe786228a71cc6f1f46a228cde6e34
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest