Docker configures Alibaba Cloud Image Accelerator

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.
insert image description here

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.
insert image description here
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"]
}

insert image description here

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.
insert image description here

Guess you like

Origin blog.csdn.net/sunnyzyq/article/details/118879007