Skip to content

Instantly share code, notes, and snippets.

@qwfys
Last active August 9, 2024 14:49
Show Gist options
  • Save qwfys/aec4d2ab79281aeafebdb40b22d0b748 to your computer and use it in GitHub Desktop.
Save qwfys/aec4d2ab79281aeafebdb40b22d0b748 to your computer and use it in GitHub Desktop.
国内拉取google kubernetes镜像

常用镜像仓库

  https://gcr.io/google-containers/

  https://gcr.io/kubernetes-helm/

  https://gcr.io/google-containers/pause

国内镜像源

  部分国外镜像仓库无法访问,但国内有对应镜像源,可以从以下镜像源拉取到本地然后重改tag即可:

  • 阿里云镜像仓库

  可以拉取k8s.gcr.io镜像

#示例
docker pull k8s.gcr.io/pause:3.2

#改为
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.2
  • dockerhub镜像仓库

  可以拉取k8s.gcr.io镜像

#示例
docker pull k8s.gcr.io/pause:3.1
docker pull k8s.gcr.io/kube-apiserver:v1.17.3

#改为
docker pull googlecontainersmirrors/pause:3.1
docker pull googlecontainersmirrors/kube-apiserver:v1.17.3
  • 七牛云镜像仓库

  可以拉取k8s.gcr.io镜像

#示例
docker pull quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.30.0

#改为
docker pull quay-mirror.qiniu.com/kubernetes-ingress-controller/nginx-ingress-controller:0.30.0
  • Docker hub搜索镜像

  很多国外镜像已经有热心网友传到了dockerhub,例如gcr.io/kubernetes-helm/tiller:v2.16.5这个镜像,直接搜索关键字,找到排序靠前的然后在dockerhub确认并拉取即可:

# docker search tiller
NAME                                    DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
jessestuart/tiller                      Nightly multi-architecture (amd64, arm64, ar  19                                      [OK]
sapcc/tiller                            Mirror of https://gcr.io/kubernetes-helm/til  9                                       
ist0ne/tiller                           https://gcr.io/kubernetes-helm/tiller           ....                                                                       

dockerhub镜像国内加速

sudo mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://uyah70su.mirror.aliyuncs.com"]
}
EOF
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
sudo mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://dockerhub.mirrors.nwafu.edu.cn/"]
}
EOF
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<- 'EOF'
{
    "registry-mirrors": ["https://7bafc985f90c43b887a96c2b846cf984.mirror.swr.myhuaweicloud.com"]
}
EOF

然后重新启动 Docker 服务:

sudo systemctl daemon-reload && sudo systemctl restart docker

验证加速器是否生效 执行 $ docker info,如果从结果中看到了如下内容,说明配置成功。

$ docker info | grep Mirrors -A1
Registry Mirrors:
 https://uyah70su.mirror.aliyuncs.com/

#验证镜像拉取速度
$ time docker pull centos

特别说明   本文转载自CSDN博客-国内拉取google kubernetes镜像,支持原创请稳步原博客。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment