人生若只如初见

WXY

Docker镜像加速器,国内可用源

2023-12-29

前言

网上搜索到的许多Docker Hub 镜像加速器文章提供的镜像地址通常不可用,或许已经失效。因此,在此做个记录,本文会长期更新保持可用。

2023-12-27-lffvrirt.jpeg

Docker 镜像加速器列表

镜像加速器地址

docker.1panel.live

hub.rat.dev

https://docker.anyhub.us.kg

https://docker.chenby.cn

https://dockerhub.jobcher.com/

https://dockerhub.icu

https://docker.awsl9527.cn

https://docker.hpcloud.cloud

https://atomhub.openatom.cn

https://docker.m.daocloud.io

https://dockerproxy.cn/

https://dockerpull.com/

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

创建或修改 /etc/docker/daemon.json: registry-mirrors 从上面选择可用地址使用即可

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
    "registry-mirrors": [
        "https://docker.anyhub.us.kg",
        "https://dockerhub.jobcher.com",
        "https://dockerhub.icu",
        "https://docker.awsl9527.cn"
    ]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

检查加速器是否生效

命令行执行 docker info,如果从结果中看到了如下内容,说明配置成功。

Registry Mirrors:
 [...]
 https://docker.m.daocloud.io

Docker Hub 镜像测速

使用镜像前后,可使用 time 统计所花费的总时间。测速前先移除本地的镜像!

$ docker rmi node:latest
$ time docker pull node:latest
Pulling repository node
[...]

real   1m14.078s
user   0m0.176s
sys    0m0.120s