docker images | grep "registry.aliyuncs.com\/google_containers" | sed 's/registry.aliyuncs.com\/google_containers/registry.k8s.io/' | awk '{print "docker tag "$3" "$1":"$2""}' | bash
docker images
: 列出镜像
grep "registry.aliyuncs.com\/google_containers"
: 过滤出需要更改标签的镜像
sed 's/registry.aliyuncs.com\/google_containers/registry.k8s.io/'
: 替换原标签
awk '{print "docker tag "$3" "$1":"$2""}'
: 打印更改标签命令
bash
: 将输出的命令执行
docker images | grep "registry.k8s.io" | awk '{print "docker rmi "$1":"$2""}' | bash