1. Log in to Alibaba Cloud and get the acceleration address
Address: https://cr.console.aliyun.com/cn-beijing/instances/mirrors
Open the above address, authorize the login (register one if you do not have an Alibaba Cloud account), and copy the accelerator address.
2. Check if daemon.json exists
Enter the server where your docker is located, and enter the /etc/docker directory to see if there is a daemon.json file, if not, create the file.
Related commands:
# 进入 /etc/docker 目录
cd /etc/docker/
# 查看列表
ls
# 创建 daemon.json 文件
touch daemon.json
3. Modify the daemon.json file
Add the following content to the daemon.json file (where xxxxx is your Alibaba Cloud acceleration address)
{
"registry-mirrors": ["xxxxxx"]
}
4. Restart the daemon
sudo systemctl daemon-reload
5. Restart docker
sudo systemctl restart docker
6. Check if the configuration is successful
docker info
Check whether the configuration is successful through the docker info command. If you see our configuration, it means that the configuration has been successful.