找了一圈,没有找到简单的方法。
- How to delete images from a private docker registry? - Stack Overflow
- Docker Registry 2.0 - how to delete unused images? - Stack Overflow
我具体描述一下我的需求:仓库有四个分支 current_feature, master, pre_production, production,其中 master 跟环境没有任何关系。current_feature 对应 dev 环境,pre_production 对应 pre_production 环境,production 对应 production 环境。镜像的标签是 current_feature-latest, current_feature-{shortCommitHash}, pre_production-latest, pre_production-{shortCommitHash}, production-latest, production-{shortCommitHash}。我想删除掉旧的镜像,包含非latest 和旧shortCommitHash 的镜像。