通过修改daemon配置文件/etc/docker/daemon.json来使用加速器
Docker Desktop
设置 > Docker Engine
以阿里云镜加速器像为例
登录容器镜像服务控制台,在左侧导航栏选择镜像工具 > 镜像加速器,在镜像加速器页面获取加速器地址。
{
"builder": {
"gc": {
"defaultKeepStorage": "40GB",
"enabled": true
}
},
"experimental": false,
"registry-mirrors": ["https://1111.mirror.aliyuncs.com"]
}
linux
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://8tqsryms.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker