如何配置Docker使用国内镜像源加速,才能生效?

我执行docker info

 Registry Mirrors:
  https://ev9s0y223.mirror.aliyuncs.com/
  https://docker.mirrors.ustc.edu.cn/
 Live Restore Enabled: false

WARNING: API is accessible on http://0.0.0.0:2375 without encryption.
         Access to the remote API is equivalent to root access on the host. Refer
         to the 'Docker daemon attack surface' section in the documentation for
         more information: https://docs.docker.com/go/attack-surface/
WARNING: No swap limit support

WARNING: The devicemapper storage-driver is deprecated, and will be removed in a future release.
         Refer to the documentation for more information: https://docs.docker.com/go/storage-driver/
WARNING: devicemapper: usage of loopback devices is strongly discouraged for production use.
         Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.

已经可以看到镜像源了。 然后
sudo systemctl daemon-reload
sudo systemctl restart docker
这两条也执行了。
但是,但是拉镜像的时候还是从docker.io拉, 请教各位大佬还有啥要处理的?

{
“registry-mirrors”:[“https://ev9s0y223.mirror.aliyuncs.com/”]
}
上面这个已配置,也重启了
sudo systemctl daemon-reload
sudo systemctl restart docker

就想用国内的镜像源加速,现在安装太耗时了,随便就是几个小时!

阅读 3k
1 个回答

阿里云的那个源本来就很慢,加上你要拉取的镜像很大。。。

image.png

怎么判断镜像源是不是生效了,可以打开docker的debug日志,然后pull镜像的时候看看日志,就知道是不是走了镜像源了。如果你看到日志里面是走了代理的地址拉取的镜像,还是慢,那就是镜像本身速度就很慢。

{
  "log-level": "debug",
  "registry-mirrors": ["https://xxx1.com","https://xxx2.com"]
}

基本上现在国内没几个能用的镜像源了,要么也很慢,要么停止服务了。
我建议你有条件的话,配个代理,从代理下可能都比镜像快,我已经很久没用配过镜像了。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题