blog/kubernetes/installation/scripts/get_images.sh

15 lines
552 B
Bash
Raw Normal View History

2022-06-18 16:02:45 +08:00
#!/bin/bash
HTTPS_PROXY=$1
IMAGE_REGISTRY=$2
IMAGE_REGISTRY_USER=$3
2022-06-21 09:58:12 +08:00
IMAGES=$(kubeadm config images list | grep k8s.gcr.io)
2022-06-18 16:02:45 +08:00
for IMAGE in ${IMAGES[@]}
do
echo "pull image ${IMAGE}"
https_proxy=${HTTPS_PROXY} ctr images pull --all-platforms ${IMAGE}
IMAGE_NAME=$(echo ${IMAGE}|sed -e 's|.*/||g')
ctr images tag ${IMAGE} ${IMAGE_REGISTRY}/${IMAGE_NAME}
ctr images push -k -u ${IMAGE_REGISTRY_USER} ${IMAGE_REGISTRY}/${IMAGE_NAME}
# ctr images rm ${IMAGE}
done
#192.168.0.144:1080 ccr.ccs.tencentyun.com/kgcrio 100004225373:Hello2022