Home > Operation and Maintenance > Docker > How to change the domestic image source in docker

How to change the domestic image source in docker

王林
Release: 2020-08-25 16:59:02
forward
16375 people have browsed it

How to change the domestic image source in docker

Reason for change

Accessing the official Docker image in China has always been as slow as a snail. In order to quickly access the Docker official image, a third-party accelerator will be configured. Currently, the commonly used three-party accelerators are: NetEase, USTC, DaoCloud, and Alibaba Cloud.

(Recommended tutorial: docker tutorial)

Now Docker has officially launched an image acceleration service for China. Through Docker official image acceleration, domestic users can access the most popular Docker images with faster download speeds and greater stability.

How to use the official image?

Docker China’s official image acceleration can be accessed through registry.docker-cn.com. Currently, the mirror library only contains popular public images, while private images still need to be pulled from the US mirror library.

You can use the following command to pull directly from the image acceleration address.

docker pull registry.docker-cn.com/myname/myrepo:mytag
Copy after login

An example is as follows:

docker pull registry.docker-cn.com/library/ubuntu:16.04
Copy after login

Note: Unless you modify the --registry-mirror parameter of the Docker daemon, you will need to fully specify the name of the official mirror. For example, library/ubuntu, library/redis, library/nginx.

Configure the accelerator for the Docker daemon process

Start Docker through the configuration file, modify the /etc/docker/daemon.json file and add the registry-mirrors key value.

sudo vim /etc/docker/daemon.json
{
 "registry-mirrors": ["https://registry.docker-cn.com"]
}
Copy after login

You can also choose NetEase’s mirror address: http://hub-mirror.c.163.com

{
“registry-mirrors”: [“http://hub-mirror.c.163.com”]
}
Copy after login

After saving the modification, restart Docker to make the configuration take effect.

sudo service docker restart
Copy after login

Then the speed went up to a higher level.

The above is the detailed content of How to change the domestic image source in docker. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template