Ubuntu 16.04+、Debian 8+、CentOS 7
对于使用 systemd 的系统,请在 /etc/docker/daemon.json 中写入如下内容(如果文件不存在请新建该文件)
{
"registry-mirrors": [
"https://dockerhub.azk8s.cn",
"https://hub-mirror.c.163.com"
]
}
注意,一定要保证该文件符合 json 规范,否则 Docker 将不能启动。
之后重新启动服务。
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
执行 $ docker info,如果从结果中看到了如下内容,说明配置成功。
Registry Mirrors:
https://dockerhub.azk8s.cn/
参考:
https://yeasy.gitbooks.io/docker_practice/install/mirror.html
https://ieevee.com/tech/2016/09/28/docker-mirror.html
https://docs.docker.com/registry/recipes/mirror/
添加 docker hub 的 mirrors 镜像源,加速镜像获取
原文:https://www.cnblogs.com/xwgli/p/12287556.html