修改docker镜像源为国内镜像

开源世界 7 个月前 回复

, ,

一、国内加速地址
1、阿里云镜像站:(需登录,免费)

https://.mirror.aliyuncs.com
2、网易云镜像站:

http://hub-mirror.c.163.com
3、百度云镜像站:

https://mirror.baidubce.com
4、上海交大镜像站:

https://docker.mirrors.sjtug.sjtu.edu.cn
5、南京大学镜像站:

https://docker.nju.edu.cn

二、修改方法
创建或修改 /etc/docker/daemon.json 文件,修改为如下形式

{
"registry-mirrors": [
"https://registry.hub.docker.com",
"http://hub-mirror.c.163.com",
"https://mirror.baidubce.com",
"https://docker.mirrors.sjtug.sjtu.edu.cn",
"https://docker.nju.edu.cn"
]
}

加载重启docker

systemctl restart docker
查看是否成功

docker info

Docker Hub 镜像测速

# 测速前先移除本地的镜像!
$ docker rmi nginx:latest

# 使用 time 统计所花费的总时间。
$ time docker pull nginx:latest

Pulling repository nginx
[...]

real 1m14.078s
user 0m0.176s
sys 0m0.120s

三、从指定repo拉取镜像
命令格式: library/

$ docker pull busybox

# 指定Repo拉取镜像,等价于:
$ docker pull hub-mirror.c.163.com/library/busybox:latest
$ docker pull docker.io/library/busybox:latest
$ docker pull registry.hub.docker.com/library/busybox:latest

支付宝打赏微信打赏

如果此文对你有帮助,欢迎打赏作者。

发表评论

欢迎回来 (打开)

(必填)