配置 Docker 国内镜像加速

可用curl命令测试当前网址是否失效;
如:
curl -I https://docker.1ms.run
如果返回 Connection timed outCould not resolve host,说明该镜像源不通。

sudo tee /etc/docker/daemon.json <<'EOF'
{
  "registry-mirrors": [
    "https://docker.m.daocloud.io",
    "https://docker.1ms.run",
    "https://docker-0.unsee.tech",
    "https://docker.xuanyuan.me"
  ]
}
EOF

确认配置

cat /etc/docker/daemon.json
  • 有以下输出:
{
  "registry-mirrors": [
    "https://docker.m.daocloud.io",
    "https://docker.1ms.run",
    "https://lispy.org",
    "https://docker-0.unsee.tech",
    "https://docker.xuanyuan.me"
  ]
}

重启 Docker

sudo systemctl daemon-reload && sudo systemctl restart docker

验证配置

docker info | grep -A 5 "Registry Mirrors"

更多推荐