2024年6月,国内几家Docker Hub镜像服务平台均发公告宣布下架,停止服务,需要更换 Docker 加速镜像源。
2024-09-08 更新,目前docker hub已恢复访问,国内相关镜像站暂时仍未恢复。
0.可用性检测
1.当前可用的镜像加速地址
1.1 大毛镜像加速地址
{
"registry-mirrors": [
"https://docker.m.daocloud.io",
"https://huecker.io",
"https://dockerhub.timeweb.cloud",
"https://noohub.ru"
]
}
也可以直接使用加速地址下载:
docker pull m.daocloud.io/docker.io/library/alpine:latest
1.2 其他国内镜像加速地址
Azure 中国镜像
https://dockerhub.azk8s.cn
七牛云加速器https://reg-mirror.qiniu.com
网易http://hub-mirror.c.163.com
华为云https://05cec16ef1800f790fabc01198b68720.mirror.swr.myhuaweicloud.com
或者使用阿里云提供的镜像加速服务,自己的加速地址可以在
https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
获取到。
貌似已无法使用
1.3 Yandex 容器加速 【更新太慢 太旧】
优点:适合单独pull镜像使用,俄罗斯大厂提供服务
缺点:不支持配置到 daemon.json
官方镜像:https://mirror.yandex.ru/
使用方式:
docker pull cr.yandex/mirror/nginx
# 更新太慢
docker pull cr.yandex/mirror/alpine:latest
可以拉取后retag到本地的镜像仓库
1.4 v2网友提供 【当前推荐】
v2网友提供的加速地址:https://dockerhub.icu
使用命令参考:
docker pull dockerhub.icu/library/alpine:latest
docker image tag dockerhub.icu/library/alpine:latest library/alpine:latest
1.5 福吧吧友推荐【当前推荐】
地址①:dockerpull.com
地址②:dockerproxy.cn
docker pull dockerproxy.cn/whyour/qinglong:latest
支持配置到/etc/docker/daemon.json
文件
{"registry-mirrors": ["https://dockerproxy.cn"]}
systemctl daemon-reload
systemctl restart docker
1.6 AtomHub 可信镜像中心
只依赖基础镜像的话,可以选择AtomHub(开放原子开源基金会牵头)
地址:https://atomhub.openatom.cn/repos
使用命令参考:
docker pull atomhub.openatom.cn/library/hello-world:latest
docker image tag atomhub.openatom.cn/library/hello-world:latest library/hello-world:latest
1.7 使用Github Action将国外的Docker镜像转存到阿里云私有仓库
1.8 系统代理
还可以配置代理,参考:Docker系统代理官方文档
2.修改配置文件
修改或创建daemon.json
文件:vi /etc/docker/daemon.json
,将以下配置写入到文件中,保存并退出:
{
"registry-mirrors": [
"https://docker.m.daocloud.io",
"https://huecker.io",
"https://dockerhub.timeweb.cloud",
"https://noohub.ru"
]
}
初次配置镜像源,可直接使用命令(以毛子镜像源为例,可替换成自己需要的镜像源地址):
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://docker.m.daocloud.io",
"https://huecker.io",
"https://dockerhub.timeweb.cloud",
"https://noohub.ru"
]
}
EOF
3.重启
重启docker(添加配置文件后需要加载然后重启docker):
systemctl daemon-reload
systemctl restart docker
评论区