docker 批量更改镜像标签


批量更改镜像标签

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



Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐