#!/bin/bash #所有app镜像 images=( repository.anxinyun.cn/anxinyun/smislocal-alarm:6.21-03-18=repository.anxinyun.cn/anxinyun/smislocal-alarm:6.21-03-18 repository.anxinyun.cn/local/config_center:latest=repository.anxinyun.cn/local/config_center:latest repository.anxinyun.cn/anxinyun/api:137.21-08-17=repository.anxinyun.cn/anxinyun/api:137.21-08-17 repository.anxinyun.cn/anxinyun/console-web:75.21-06-10=repository.anxinyun.cn/anxinyun/console-web:75.21-06-10 repository.anxinyun.cn/anxinyun/project:latest=repository.anxinyun.cn/anxinyun/project:latest repository.anxinyun.cn/local/et:latest=repository.anxinyun.cn/local/et:latest repository.anxinyun.cn/iota/dac:28.21-04-14=repository.anxinyun.cn/iota/dac:28.21-04-14 repository.anxinyun.cn/iota/prometheus:latest=repository.anxinyun.cn/iota/prometheus:latest repository.anxinyun.cn/anxin/iota-proxy:latest=repository.anxinyun.cn/anxin/iota-proxy:latest repository.anxinyun.cn/iota/web-console-api:50.21-05-24=repository.anxinyun.cn/iota/web-console-api:50.21-05-24 repository.anxinyun.cn/anxinyun/py.rpc:dragon.32=repository.anxinyun.cn/anxinyun/py.rpc:dragon.32 repository.anxinyun.cn/local/report-client:12.21-10-28=repository.anxinyun.cn/local/report-client:12.21-10-28 ) OIFS=$IFS # 保存旧值 imagelist=() imageindex=1 for image in ${images[*]}; do IFS='=' set $image echo "准备拉取 $2" microk8s.ctr image pull $2 if [ $1 != $2 ]; then microk8s.ctr image tag $2 $1 microk8s.ctr image rm $2 fi imagelist[imageindex]=$1 imageindex=$((imageindex + 1)) echo "拉取成功" tempname=${2##*/} echo "tempname=$tempname" newtarname=${tempname/:/-} echo "tar存储镜像 $newtarname" microk8s.ctr image export "./${newtarname}.tar" $1 IFS=$OIFS # 还原旧值 done echo "${imagelist[*]}" #microk8s.ctr image export ./baseImages.tar ${imagelist[*]} #全部导入一个tar #microk8s.ctr image export ./emqx:4.3.5.tar docker.io/emqx/emqx:4.3.9 # emqx导出问题?先用docker导出 #docker save -o emqx-4.3.9.tar docker.io/emqx/emqx:4.3.9 return 0