批量更改镜像标签
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
: 将输出的命令执行文章来源地址https://www.toymoban.com/news/detail-812721.html
批量删除镜像
docker images | grep "registry.k8s.io" | awk '{print "docker rmi "$1":"$2""}' | bash
文章来源:https://www.toymoban.com/news/detail-812721.html
到了这里,关于docker 批量更改镜像标签的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!