#!/bin/bash
set -x 

newrepo=dockerhub.kubekey.local:7443
oldrepo=registry.k8s.io

dockerimages=(
ingress-nginx/controller:v1.12.1
ingress-nginx/kube-webhook-certgen:v1.5.2
)

j=1
for i in ${dockerimages[@]}
do
    echo $i
    echo $j

    docker pull $oldrepo/$i
    docker tag $oldrepo/$i $newrepo/$i
#    docker rmi $i $newrepo/$i

    let j+=1
done

docker save $newrepo/ingress-nginx/controller:v1.12.1 $newrepo/ingress-nginx/kube-webhook-certgen:v1.5.2 -o ingress-nginx-controllerv1.12.1.tar
set +x

