Docker Hub 镜像加速器


国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

创建或修改 /etc/docker/daemon.json

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
    "registry-mirrors": [
        "https://dockerproxy.com",
        "https://docker.mirrors.ustc.edu.cn",
        "https://docker.nju.edu.cn"
    ]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

Docker Hub 镜像加速器列表

以下镜像站来源于互联网,可能出现宕机、转内网、关停等情况,建议同时配置多个镜像源。

镜像加速器镜像加速器地址专属加速器其它加速
Docker 中国官方镜像https://registry.docker-cn.comDocker Hub已关闭
DaoCloud 镜像站https://docker.m.daocloud.ioDocker Hub、GCR、K8S、GHCR、Quay、NVCR 等
Azure 中国镜像https://dockerhub.azk8s.cn仅供内部访问Docker Hub、GCR、Quay
科大镜像站https://docker.mirrors.ustc.edu.cn仅供内部访问Docker Hub、GCRQuay
阿里云https://<your_code>.mirror.aliyuncs.com需登录,系统分配Docker Hub
七牛云https://reg-mirror.qiniu.comDocker Hub、GCR、Quay
网易云https://hub-mirror.c.163.comDocker Hub
腾讯云https://mirror.ccs.tencentyun.com仅供内部访问Docker Hub
Docker 镜像代理 https://dockerproxy.comDocker Hub、GCR、K8S、GHCR
百度云 https://mirror.baidubce.comDocker Hub
南京大学镜像站 https://docker.nju.edu.cnDocker Hub、GCR、GHCR、Quay、NVCR 等
上海交大镜像站 https://docker.mirrors.sjtug.sjtu.edu.cnDocker Hub、GCR 等
中科院软件所镜像站 https://mirror.iscas.ac.cnDocker Hub
huecker(ru)https://huecker.ioDocker Hub
timeweb.cloud(ru)https://dockerhub.timeweb.cloudDocker Hub

⚠️ 部分网友反馈以下镜像站存在未同步最新源镜像问题,请按需选用

  • 阿里云

检查加速器是否生效

命令行执行 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

参考链接

  • https://docs.docker.com/registry/recipes/mirror/
  • https://github.com/yeasy/docker_practice/blob/master/install/mirror.md
  • https://github.com/moby/moby/blob/d409b05970e686993e343d226fae5b463d872082/docs/articles/registry_mirror.md
  • https://www.fengbohello.top/archives/docker-registry-mirror
  • https://www.ilanni.com/?p=14534
  • https://github.com/Azure/container-service-for-azure-china/blob/master/aks/README.md#22-container-registry-proxy
  • https://moelove.info/2020/09/20/突破-DockerHub-限制全镜像加速服务/

提示:更多内容可以访问Clang’s Blog:https://www.clang.asia

  • 23
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值