006_docker国内镜像加速
2022-01-26 本文已影响0人
AI秘籍
1.摘要
国内从DockerHub拉取镜像有时会遇到困难,此时可以配置镜像加速器。
Docker官方和国内很多云服务商都提供了国内加速器服务,建议根据运行docker的云平台选择对应的镜像加速服务。
下面列出国内常用的加速站点,排名不分先后,总体来说阿里云速度较稳定。
docker中国区官方镜像加速:
<u>https://registry.docker-cn.com</u>
网易镜像加速:
<u>http://hub-mirror.c.163.com</u>
中国科技大学镜像加速:
<u>https://docker.mirrors.ustc.edu.cn</u>
腾讯云镜像加速:
<u>https://mirror.ccs.tencentyun.com</u>
阿里云镜像加速:
<u>https://ung2thfc.mirror.aliyuncs.com</u>
2. Ubuntu中添加镜像加速
创建或修改/etc/docker/daemon.json文件默认没有daemon文件,先创建。
vim /etc/docker/daemon.json
添加如下内容:
{
"registry-mirrors": [
“https://ung2thfc.mirror.aliyuncs.com ”,
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn"
]
}

3.加载重启docker
在终端输入以下命令
systemctl daemon-reload
systemctl restart docker
4.验证是否成功
打开终端执行docker info命令,可见下面信息。

拉取镜像,速度极快。
5. Win10中添加镜像加速
在registry-mirros参数上添加加速地址。


参考: