给Docker换国内镜像源

Tags:

参考 https://www.hostloc.com/thread-800586-1-1.html

安装

# 安装docker
apt install -y docker.io
systemctl start docker
systemctl enable docker

# 修改源,加多个国内源
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": [
    "https://0b27f0a81a00f3560fbdc00ddd2f99e0.mirror.swr.myhuaweicloud.com",
    "https://ypzju6vq.mirror.aliyuncs.com",
    "https://registry.docker-cn.com",
    "http://hub-mirror.c.163.com",
    "https://docker.mirrors.ustc.edu.cn"
  ]
}
EOF

# 重启
sudo systemctl daemon-reload
sudo systemctl restart docker

确认

docker info|grep Mirrors -A 10

Leave a Reply