Downloading images from Docker Hub is difficult to efficiently download for well-known reasons.
In addition to using a VPN or proxy, the most effective way is to use Docker domestic images.
DaoCloud is the first group to provide domestic free Docker Hub mirrors, and you can use the Docker Hub Mirror service provided by the DaoCloud team.
Introduction to Docker Accelerator
Docker Accelerator is the official name of the Docker Hub Mirror service launched by DaoCloud.
Docker Accelerator provides Docker Registry (Docker Hub) image proxy service in China, and caches many images on domestic servers for Chinese users.
When the user's Docker sets the --registry-mirror parameter, when the user's Docker pulls the image, it first searches for the image in the Docker accelerator. If it hits, it means that the image has been cached in the Docker accelerator, and the user directly downloads the image from the Docker accelerator. download.
If there is no hit, it means that the image has not been cached, then the Docker accelerator will first be driven to download the image from Docker Hub, cache it, and finally let the user download the image from the Docker accelerator.
Docker Accelerator Instructions for Use
Register and log in at DaoCloud .
On the login page ( https://dashboard.daocloud.io/ ), click the "Product -> Accelerator" tab, change your Docker configuration file according to the "Configure Docker Accelerator" information in the newly popped up page, and then restart Docker , to make it effective.
Note: At this point, from the "Configure Docker Accelerator" information, we actually have a free docker image address, similar to " http://abcd1234.m.daocloud.io".
Example: Configuring and Using Docker Accelerator
Here is an example of a Linux system.
Linux
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://abcd1234.m.daocloud.io
This script can add --registry-mirror to your Docker configuration file /etc/default/docker. Applicable to Ubuntu14.04, Debian, CentOS6, CentOS7, Fedora, Arch Linux, openSUSE Leap 42.1, other versions may be slightly different. Visit the documentation for more details .
Configure Docker Accelerator
[root@CentOS-7 ~]# uname -a
Linux CentOS-7 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://abcd1234.m.daocloud.io
Success.
You need to restart docker to take effect: sudo systemctl restart docker
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# systemctl restart docker
[root@CentOS-7 ~]#
If the restart fails, manually configure the accelerator to restart, steps:
- Create or modify the /etc/docker/daemon.json file and modify it to the following form (please replace the acceleration address with the exclusive address obtained on the accelerator page)
{
"registry-mirrors": [
"加速地址"
],
"insecure-registries": []
}
- systemctl restart docker
Pull images using the Docker accelerator
[root@CentOS-7 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# docker run ubuntu
Unable to find image 'ubuntu:latest' locally
Trying to pull repository docker.io/library/ubuntu ...
latest: Pulling from docker.io/library/ubuntu
b3e1c725a85f: Pull complete
4daad8bdde31: Pull complete
63fe8c0068a8: Pull complete
4a70713c436f: Pull complete
bd842a2105a8: Pull complete
Digest: sha256:dbe36a89ad8daf8bbd2a68f14eab18b969d3f125104da51df6337bbf08d1c8ae
Status: Downloaded newer image for docker.io/ubuntu:latest
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/ubuntu latest 104bec311bcd 8 days ago 128.9 MB
[root@CentOS-7 ~]#