1. Create or modify daemon.json
Daemon. json file is stored in /etc/docker-daemon. json file. Use vi or vim to open daemon.json file.
vim /etc/docker/daemon.json
Copy the code
In the etc directory, the docker folder may not exist. You need to manually create the folder: mkdir /etc/docker
2. Daemon. json configuration
Copy and paste the following directly:
{
"registry-mirrors" : [
"https://mirror.ccs.tencentyun.com",
"http://registry.docker-cn.com",
"http://docker.mirrors.ustc.edu.cn",
"http://hub-mirror.c.163.com"
],
"insecure-registries" : [
"registry.docker-cn.com",
"docker.mirrors.ustc.edu.cn"
],
"debug" : true,
"experimental" : true
}
Copy the code
Aliyun also has docker source, but it is a bit more troublesome. If necessary, you can apply for aliyun container service as follows: “Cr.console.aliyun.com/” page, click on the “create my container mirror” get an exclusive image of accelerating address, similar to “1234 abcd.mirror.aliyuncs.com”
3. Restart docker
According to the different ways of installing Docker on Linux, select the corresponding restart command:
#Systemctl way
systemctl restart docker.service
#The snap way
snap restart docker
Copy the code