下载google镜像

通过以下的URL浏览google的docker镜像

https://console.cloud.google.com/gcr/images/google-containers?project=google-containers

直接使用docker命令去下载google上的镜像一般都会失败,除非你的主机是在境外。我们可以尝试以下方法。

docker-proxy(推荐)

如果你有一个代理服务器,能翻墙,那么可以为docker-daemon设置代理。docker-daemon在启动的时候会检查环境变量http_proxyhttps_proxy以及no_proxy,如果docker-daemon启动后再设置这些环境变量,是没有用的。

设置这三个环境变量有几种方法:

  • 全局设置

    /etc/profile中设置

  • 只为docker-daemon服务设置

docker.service文件中添加Environment这样的一行,参考https://docs.docker.com/config/daemon/systemd/#httphttps-proxy

[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"

github.com/anjia0532

github上有人把google的镜像备份到了docker_hub上,镜像名字的映射规则与下载方法参考:

https://github.com/anjia0532/gcr.io_mirror

不过,从他这上面下载的镜像,镜像的digest与google官方镜像的digest会不一样,container_id是一样的

阿里云镜像仓库

阿里云的镜像仓库会同步google中的镜像,比如google的镜像名映射到阿里云的镜像规划为

k8s.gcr.io/<image>:<tag> -> registry.cn-hangzhou.aliyuncs.com/google_containers/<image>:<tag>

https://dev.aliyun.com/search.html

Last updated