blog/kubernetes/installation/scripts/get_images.sh

15 lines
547 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
2023-03-16 17:41:46 +08:00
IMAGES=$(kubeadm config images list | grep registry.k8s.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
2023-03-16 17:41:46 +08:00
#192.168.0.144:1080 ccr.ccs.tencentyun.com/kgcrio 100004225373