镜像清理工具:
wget https://s3.eu-west-2.amazonaws.com/nexus-cli/1.0.0-beta/linux/nexus-cli
chmod +x nexus-cli
./nexus-cli configure
-
Enter Nexus Host: http://127.0.0.1:8081
-
Enter Nexus Repository Name: test
-
Enter Nexus Username: admin
-
Enter Nexus Password: xxxxxx
查看镜像
./nexus-cli image ls
查看镜像信息
-
nexus-cli image tags -name IMAGE_NAME #查看某一镜像的所有的tag
-
nexus-cli image info -name IMAGE_NAME -tag TAG #查看某一镜像详细信息
删除镜像
-
nexus-cli image delete -name IMAGE_NAME -tag TAG #删除指定tag的指定镜像
-
nexus-cli image delete -name IMAGE_NAME -keep X #仅保留X项tag,其余全部删除
-
例如清理具体的镜像,保留版本号最大的5个: ./nexus-cli image delete -n 123.com/web -k 5
因为我的tag都是统一latest,统一的tag上传还是会占有很多空间,虽然只看到一个images的tag,10多个镜像200m左右,上传了一个月左右居然达到150左右,所以直接按图执行就可了
(1)delete unused docker manifests and images(2)Compact blob store 之前只执行了Compact blob store 这个清理 效果不大
两个执行后,再看空间从150g 降到10多G