Thank you for reading. This article is copyrighted by Yang Bin. If reproduced, please indicate the source: Yang bin’s blog (y0ngb1n. Making. IO/a/docker – re…


In this paper, starting from making Gist:gist.github.com/y0ngb1n/7e8… , welcome Star: Kissing_heart :\

Sometimes it is difficult to pull the image from Docker Hub in China, so you can configure the image accelerator. Docker official and many domestic cloud service providers provide domestic accelerator services.

Configuring the Acceleration Address

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://1nj0zren.mirror.aliyuncs.com"."https://docker.mirrors.ustc.edu.cn"."http://f1361db2.m.daocloud.io"."https://registry.docker-cn.com"
    ]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
Copy the code

Docker Hub Image accelerator list

Mirror accelerator Mirror accelerator address Exclusive accelerator? Other accelerated?
Docker China official image https://registry.docker-cn.com Docker Hub
DaoCloud mirror stand http://f1361db2.m.daocloud.io Login, system allocation Docker Hub
Azure China Mirror https://dockerhub.azk8s.cn Docker Hub, GCR, Quay
Hkust Mirror Station https://docker.mirrors.ustc.edu.cn Docker Hub,GCR,Quay
Ali cloud https://<your_code>.mirror.aliyuncs.com Need to log in, system assignment Docker Hub
Seven NiuYun https://reg-mirror.qiniu.com Docker Hub, GCR, Quay
Netease cloud https://hub-mirror.c.163.com Docker Hub
Tencent cloud https://mirror.ccs.tencentyun.com Docker Hub

Check whether the accelerator is working

Run the docker info command. If the following information is displayed, the configuration is successful.

Registry Mirrors: [...]  https://registry.docker-cn.com/Copy the code

Docker Hub image speed measurement

You can use time to count the total time spent before and after mirroring. Remove local image before speed measurement!

$ docker rmi node:latest
$ time docker pull node:latestPulling repository node [...] Real 1m14.078s user 0m0.176s sys 0m0.120SCopy the code

Refer to the link

  • Docs.docker.com/registry/re…
  • Github.com/yeasy/docke…
  • Github.com/moby/moby/b…
  • www.fengbohello.top/archives/do…
  • www.ilanni.com/?p=14534