docker 批量更改镜像标签

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



你可能感兴趣的:(Docker,docker,容器,运维)