#!/bin/bash 
#author=ZhangHao

images=$(docker images | awk '{if(NR > 1) print $1":"$2}')

read -p "请输入仓库地址: " regadd
for i in $images
do 
  docker tag $i  "$regadd/${i##*/}"
  docker push "$regadd/${i##*/}"
  docker rmi $i
done

Q.E.D.