Docker / Kubernetes mirroring

For reasons known, Docker official mirror mirror warehouse storage and Google in-country visit is slow or unavailable. This gives us a great deal of inconvenience at the time of deployment and use Kubernetes. Today we'll introduce several ways you can make a pleasant solve the problem.
Since it is a network problems and solving this problem is very simple, of course, is to use the available domestic mirror source. Here we recommend two easy to use for everyone domestic mirror source: Azure China USTC mirror mirror source and source.
Azure China mirror source  
Azure China mirror source address: HTTP: // mirror.azure.cn/ 
Azure China mirroring Github Address: HTTPS: // github.com/Azure/container-service-for-azure-china 
mirroring configuration instructions: HTTP: / / mirror.azure.cn/help/gcr-proxy-cache.html
USTC mirror source
USTC mirror source address: HTTP: // mirrors.ustc.edu.cn/ 
USTC mirror source Github Address: HTTPS: // github.com/ustclug/mirrorrequest 
mirroring configuration instructions: HTTPS: // github.com/ustclug/mirrorrequest / issues / 187

Use mirror mirror source to accelerate Docker.io warehouse

hub.docker.com Docker is the official repository mirroring, which we usually use Docker process uses a mirror up to the warehouse. The Mirror warehouse usually pulling speed is usually only a few dozen Kb, very slow, use a serious impact on productivity.
Now that the country has mirrored source is available, of course we can direct the domestic mirror source. Following were introduced its use.
If the pull is in the warehouse Docker Official Official mirror pull method similar to the following: 
$ Docker pull XXX: yyy
using USTC mirror source, this pull should be similar:
$ Docker pull docker.mirrors.ustc.edu.cn
/ Library / xxx: yyy
using Azure China mirror source, this pull should be similar:
$ Docker pull dockerhub.azk8s.cn
/ Library / xxx: yyy
If the pull Docker official repository mirror private repository 
pull method similar to the following: 
$ XXX Docker pull
/ yyy: ZZ
using USTC mirror source, this pull should be similar:
$ Docker pull docker.mirrors.ustc.edu.cn
/ XXX / yyy: ZZ
using Azure China mirror source, this pull should be similar:
$ Docker pull dockerhub.azk8s.cn
/ xxx / yyy: zz
  • One example demonstrates the use of a mirror source pull
Here we pull mysql: 5.7 and 360cloud / wayne example:
# Use USTC mirroring 

$ Docker pull docker.mirrors.ustc.edu.cn / Library / MySQL: 5.7 
$ Docker pull docker.mirrors.ustc.edu.cn / 360cloud / wayne 
# using Azure China mirroring $ docker pull dockerhub. azk8s.cn
/ Library / MySQL: 5.7 $ Docker pull dockerhub.azk8s.cn / 360cloud / wayne

 

Note: There may be the first time pulling Error: image library / mysql: 5.7 not found a similar error, indicating that the source image is not cached in the mirror. This is a normal phenomena, since the official start acceleration mirror mirror warehouse are pulled, and then cached locally. In such cases, you can try a few times to take Dora.

Use mirror mirror source to accelerate gcr.io warehouse

  • If the pulled Google mirror image warehouse container similar to the following:
Docker pull gcr.io/xxx/ $ yyy: ZZZ 

using USTC mirror source, this pull should be similar: 
$ Docker pull gcr.mirrors.ustc.edu.cn / XXX / yyy: ZZZ 

using Azure China mirror source, like this should be pull: 
$ Docker pull gcr.azk8s.cn / xxx / yyy: ZZZ

 

  • One example demonstrates the use of a mirror source pull
Here we pull gcr.io/kubernetes-helm/tiller:v2. 9.1 as an example: 

# use USTC mirroring 
 $ Docker pull gcr.mirrors.ustc.edu.cn / Kubernetes-Helm / Tiller:. V2 9.1 

# use Azure China mirroring 
$ Docker pull gcr.azk8s.cn / Kubernetes-Helm / Tiller:. v2 9.1

 

Use mirror mirror source to accelerate k8s.gcr.io warehouse

When you deploy or use Kubernetes we will use a lot of related images, but these images often use k8s.gcr.io this image repository.
In fact k8s.gcr.io is gcr.io/google-containers container below the mirror, so that we can also use the Azure China USTC mirror source or a mirror source to accelerate this.
  • If we pull the mirror Kubernetes desired container form similar to the following:
Docker pull k8s.gcr.io/ $ XXX: yyy 
# Docker pull gcr.io equivalent $ / Google-Containers / XXX: yyy 

using USTC mirror source, this pull should be similar: 
$ Docker pull gcr.mirrors.ustc.edu .cn / Google-Containers / XXX: yyy 

using Azure China mirror source, this pull should be similar: 
$ Docker pull gcr.azk8s.cn / Google-Containers / XXX: yyy

 

  • One example demonstrates the use of a mirror source pull
Here we pull k8s.gcr.io/addon-resizer:1.8.3 example:
# Use USTC mirroring 
$ Docker pull gcr.mirrors.ustc.edu.cn / Google-Containers / Addon-Resizer: 1.8 . 3 
# using Azure China mirroring 
$ Docker pull gcr.azk8s.cn / Google-Containers / addon- Resizer: 1.8 . 3

Use mirror mirror source to accelerate quay.io warehouse

We often pull from quay.io Mirror Mirror warehouse when deploying or using Kubernetes related peripheral components or ecology. quay.io default in the country is not available, the same we can speed up access by USTC mirroring source and Azure China mirror source.
  • If desired container form the image similar to the pulled our quay.io:
Docker pull quay.io/xxx/ $ yyy: ZZZ 

using USTC mirror source, this pull should be similar: 
$ Docker pull quay.mirrors.ustc.edu.cn / XXX / yyy: ZZZ 

using Azure China mirror source, like this should be pull: 
$ Docker pull quay.azk8s.cn / xxx / yyy: ZZZ

 

  • One example demonstrates the use of a mirror source pull
Here we pull quay.io/coreos/kube-state-metrics:v1.5.0 example:
# Use USTC mirroring 
$ Docker pull quay.mirrors.ustc.edu.cn / CoreOS / Kube-State-metrics:. V1 5.0 
# use Azure China mirroring 
$ Docker pull quay.azk8s.cn / CoreOS / Kube-state- metrics:. v1 5.0

Some automation tools

Above we explain and demonstrate how to use the USTC and Azure China mirroring acceleration method pull mirroring. However, these methods are manual, but also not convenient enough. The following describes two small tools, so you can more easily and quickly using these mirror source.

docker-wrapper

A tool written in Python script, you can replace the system Docker command, automatic and automatic Tag pulled from Azure China as the target mirror image mirroring and delete Azure, at one go.
Project address: https: //github.com/silenceshell/docker_wrapper
docker-wrapper 安装
$ git clone https://github.com/silenceshell/docker-wrapper.git
$ sudo cp docker-wrapper/docker-wrapper.py /usr/local/bin/

docker-wrapper 使用
$ docker-wrapper pull k8s.gcr.io/kube-apiserver:v1.14.1
$ docker-wrapper pull gcr.io/google_containers/kube-apiserver:v1.14.1
$ docker-wrapper pull nginx
$ docker-wrapper pull silenceshell/godaddy:0.0.2

 

azk8spull

A script written in Shell, similar to the script function and docker-wrapper. Tag can also be automatically and automatically pull from Azure China as the target mirror image mirroring and delete Azure.
Project address: https: //github.com/xuxinkun/littleTools#azk8spull
azk8spull mounting 
$ Git clone HTTPS: // github.com/xuxinkun/littleTools$ CD littleTools 
$ the chmod + X the install . SH 
$. / the install . SH 

azk8spull use 
$ azk8spull quay.io / Kubernetes-Ingress-Controller / Nginx-ingress- the Controller: 0.24 . 1 
$ azk8spull k8s.gcr.io / PAUSE-AMD64: 3.1

 

Reference Documents

  1. https://www.google.com
  2. https://ieevee.com/tech/2019/03/02/azure-gcr-proxy.html
  3. https://www.cnblogs.com/xuxinkun/p/11025020.html
  4. https://www.ilanni.com/?p=14534

Guess you like

Origin www.cnblogs.com/kcxg/p/11457209.html