The download speed of docker hub is very slow, but you can use Alibaba Cloud docker accelerator to improve the speed, manage your images and pull other people's images
-
First you have to have an Ali account
-
Then enter the image acceleration page , and you will see an accelerator address given by Alibaba Cloud
-
Then select the corresponding system and perform the corresponding steps according to your own docker version
- Check the docker version: docker --version
[root@106 ~]# docker --version
Docker version 17.12.1-ce, build 7390fc6
[root@106 ~]#
- Different versions of docker:
- Users with docker client version greater than 1.10
- Accelerators can be used through the fat daemon configuration file /etc/docker/daemon.json
- Users with docker client version greater than 1.10
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://dhq9bx4f.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
- Users with Docker client version less than or equal to 1.10
- Or to configure the startup parameters, you can use the following command to add the configuration to the startup parameters of the docker daemon.
- System requirements CentOS 7 or above, Docker 1.9 or above
sudo cp -n /lib/systemd/system/docker.service /etc/systemd/system/docker.service
- Docker versions below 1.12 use the docker daemon command
sudo sed -i "s|ExecStart=/usr/bin/docker daemon|ExecStart=/usr/bin/docker daemon --registry-mirror=加速器地址|g" /etc/systemd/system/docker.service
- Docker 1.12 and above use the dockerd command
sudo sed -i "s|ExecStart=/usr/bin/dockerd|ExecStart=/usr/bin/dockerd --registry-mirror=加速器地址|g" /etc/systemd/system/docker.service
sudo systemctl daemon-reload
sudo service docker restart
- test
[root@106 ~]# docker pull centos
Using default tag: latest
latest: Pulling from library/centos
5e35d10a3eba: Pull complete
Digest: sha256:dcbc4e5e7052ea2306eed59563da1fec09196f2ecacbe042acbdcd2b44b05270
Status: Downloaded newer image for centos:latest
[root@106 ~]#
- You can add accelerated parameters to the docker startup item and restart the docker service
echo "DOCKER_OPTS=\"\$DOCKER_OPTS --registry-mirror=你的加速地址\"" | sudo tee -a /etc/default/docker
sudo service docker restart
- If the docker version is too low, you can upgrade the next version
curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -
- You can search for the mirror you need on the Ali website, link , and then click on the details to view the relevant information of the mirror