侧边栏壁纸
  • 累计撰写 262 篇文章
  • 累计创建 139 个标签
  • 累计收到 16 条评论

目 录CONTENT

文章目录

国内 Docker 不能下载镜像问题

Sherlock
2024-06-20 / 0 评论 / 0 点赞 / 1429 阅读 / 0 字
温馨提示:
本文最后更新于2024-09-09,若内容或图片失效,请留言反馈。 部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

2024年6月,国内几家Docker Hub镜像服务平台均发公告宣布下架,停止服务,需要更换 Docker 加速镜像源。
2024-09-08 更新,目前docker hub已恢复访问,国内相关镜像站暂时仍未恢复。

0.可用性检测

https://www.itdog.cn/ping/hub.docker.com

目前国内可用Docker镜像源汇总(截至2024年8月)

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镜像转存到阿里云私有仓库

项目地址:https://github.com/tech-shrimp/docker_image_pusher

1.8 系统代理

还可以配置代理,参考:Docker系统代理官方文档


或者参考:国内无法访问下载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
0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区