看这里:
戳此链接 通往 关于 Docker 所有的学习文章 !
前言:
当我们从 Docker Hub 上 pull images 的时候,因为Docker Hub 是国外的,由于网络原因会卡会慢;浪费我们的时间。这时候呢 就有国内的活雷锋,将 Docker Hub 上的镜像完完整整的克隆了一份到他们的云上面;供我们使用!例如 : 阿里云、网易云…
1、阿里云镜像加速:
①、注册 阿里云账号:
如果你有的话就不用注册了,直接登陆 阿里云即可!
注册或登陆地址: https://www.aliyun.com/?utm_content=se_1000301881
②、登陆阿里云平台,获取加速器地址:
因为你新安装的 Docker,默认的下载镜像地址是去 Docker Hub 上,你得给 Docker 做配置,让它下载镜像的时候 去 阿里云上面下载!
镜像加速器地址: https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
打开以后你可以看见你的专属加速器地址 和 不同版本如何安装 镜像加速器!
③、开始配置 并 重启服务:
# 我这里是 ubuntu ,centos 7 也是这样的步骤,centos 6 的话 步骤不一样,在下面有centos6的步骤
root@zhengzelin:~# cat <<end>> /etc/docker/daemon.json
{
"registry-mirrors":["https://xxxxxxx.mirror.aliyuncs.com"]
}
end
重启服务:
root@zhengzelin:~# sudo systemctl daemon-reload
root@zhengzelin:~# sudo systemctl restart docker
⑤、如果你是 centos6 :
# 如果你是 centos 7 的话,跟上面的配置一样! 是 /etc/docker/daemon.json
# 这个是只针对 centos 6 :
vim /etc/sysconfig/docker
修改配置文件:
other_args="registry-mirrors":"https://xxxxxx.mirror.aliyuncs.com"
# 这里的地址 填你自己加速地址!
重启docker:
service docker restart
2、配置网易云镜像加速:
基本上与上面 阿里云镜像加速步骤一致!只需要你将 /etc/docker/daemon/json 里的阿里云的地址,换成 网易云的地址就可以!