5

docker设置国内镜像源

 3 years ago
source link: https://www.wencst.com/archives/592
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

docker设置国内镜像源

作者: wencst 分类: docker,微服务 发布时间: 2017-08-09 10:19 阅读: 3,915 次

centos7.1

docker1.12

原始docker所使用的镜像地址是hub.docker.io,这个地址是国外的,对于国内用户来说,下载会比较慢。

方案一:网上介绍一些方法

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://48b042ae.m.daocloud.io

注:初次会生成/etc/docker/daemon.json  文件,并写入{“registry-mirrors”: [“http://48b042ae.m.daocloud.io”]}

但会遇到超时。

我将https://get.daocloud.io/daotools/set_mirror.sh 这个文件下载下来,然后
sh set_mirror.sh http://48b042ae.m.daocloud.io
执行这个文件,然后重启docker服务就可以了。

将docker服务关闭,用下面命令启动docker服务:

dockerd –registry-mirrors http://48b042ae.m.daocloud.io –insecure-registry 192.168.0.4:5000&

这个方案我没有试,因为方案二执行成功,这个方案有可能只是临时设置,以后docker再重启时还需要再执行这个命令。

我试了一下,docker search命令依然用的是index.docker.io网络,所以还是会慢,这个配置真正解决的是docker pull操作。

如果文章对您有用,扫一下支付宝的红包,不胜感激!

欢迎加入QQ群进行技术交流:656897351(各种技术、招聘、兼职、培训欢迎加入)

Leave a Reply Cancel reply

You must be logged in to post a comment.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK