!/bin/bashGREENCOLOR=’\e[032m’ #绿 RED_COLOR=’\e[031m’ #红YELLOW_COLOR=’\e[033m’ #黄BLACK_COLOR=’\e[0m’ #黑declare image_id=(docker images | tail -20 | awk '{print $3}')declare image_name=(docker images | tail -20 | awk '{print $1}' | awk -F/ '{print $NF}')declare image_version=(docker images | tail -20 | awk '{print $2}')declare image_nameqc=(docker images | tail -20 | awk '{print $1}')####for循环批量备份for i in ${!image_id[@]}do docker save ${image_id[i]} > ${image_name[i]}${imageversion[i]}.tar.gz if [ $? -eq 0 ];then echo -e “${YELLOW_COLOR}${image_id[i]} ${BLACK_COLOR} in ${YELLOW_COLOR} ${image_nameqc[i]} ${BLACK_COLOR} =====> ${GREEN_COLOR}back finish!!!${BLACK_COLOR} =====> back file is ${RED_COLOR} ${image_name[i]}${image_version[i]}.tar.gz ${BLACK_COLOR}” echo “” fidone。!/bin/bashGREENCOLOR=’\e[032m’ #绿 RED_COLOR=’\e[031m’ #红YELLOW_COLOR=’\e[033m’ #黄BLACK_COLOR=’\e[0m’ #黑declare image_id=(docker images | tail -20 | awk '{print $3}')declare image_name=(docker images | tail -20 | awk '{print $1}' | awk -F/ '{print $NF}')declare image_version=(docker images | tail -20 | awk '{print $2}')declare image_nameqc=(docker images | tail -20 | awk '{print $1}')####for循环批量备份for i in ${!image_id[@]}do docker save ${image_id[i]} > ${image_name[i]}${imageversion[i]}.tar.gz if [ $? -eq 0 ];then echo -e “${YELLOW_COLOR}${image_id[i]} ${BLACK_COLOR} in ${YELLOW_COLOR} ${image_nameqc[i]} ${BLACK_COLOR} =====> ${GREEN_COLOR}back finish!!!${BLACK_COLOR} =====> back file is ${RED_COLOR} ${image_name[i]}${image_version[i]}.tar.gz ${BLACK_COLOR}” echo “” fidone。