前言
国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。国内很多云服务商都提供了国内加速器服务,可以通过这些服务解决下载困难问题。

Docker 更换国内镜像源:
可以使用的镜像源列表

官方国内:https://registry.docker-cn.com
网易云:http://hub-mirror.c.163.com
中国科技大学:https://docker.mirrors.ustc.edu.cn
百度云:https://mirror.baidubce.com
南京大学:https://docker.nju.edu.cn
上海交通大学:https://docker.mirrors.sjtug.sjtu.edu.cn

Linux 用户
设置镜像
编辑配置文件:

nano /etc/docker/daemon.json

{

"registry-mirrors": ["https://docker.nju.edu.cn"]

}

如果你还有其他源自行参考上述格式添加

重载服务

systemctl daemon-reload
systemctl restart docker
查看是否生效:

docker info