#!/bin/bash

echo "标签替换开始"

images1=$(awk -F[#\ ]+ /image/'{print $3}' $1|grep "172")
  for i in ${images1};do
      #echo $i
      k=${i#*78}
      sourse="172.16.2.78${k}"
      dest="192.168.251.78${k}"
      echo $dest
      docker tag $sourse $dest
      docker push $dest
 done
 sed -i s/172.16.2.78/192.168.251.78/g $1
# images2=$(awk -F[#\ ]+ /image/'{print $3}' $1)
#   for i in ${images2};do
#      docker push ${i}
#   done

echo "标签替换完成"