Docker cleanup plugin
It will be good to have docker images cleanup in line with the artifactCleanup plugin. Basically allow deletion on docker images based on last download date.
Inspired from a standalone script: https://jfrog.com/knowledge-base/how-to-clean-up-old-docker-images/
Hi! Have you tried this one? https://github.com/jfrog/artifactory-user-plugins/tree/master/cleanup/cleanDockerImages
Hey @DarthFennec yes I did. The plugin unfortunately is not as good as artifactCleanup plugin for 2 reasons:
- It needs a build time label/property to be set/passed. This is not always possible if you have multiple CI systems or process pushing images
- The approach of deleting images based on download date looks to be most apt (instead of just deleting by count as the cleanDockerImages does). The jfrog blog covers the approach well and in fact dockerhub is also implementing similar approach for cleaning up inactive images: https://www.docker.com/pricing/resource-consumption-updates
It needs a build time label/property to be set/passed. This is not always possible if you have multiple CI systems or process pushing images
That's what it says on the tin yet not exactly how it works.
If you apply one or both properties on manifest.json file, it works just as well:
docker.label.com.jfrog.artifactory.retention.maxCount
docker.label.com.jfrog.artifactory.retention.maxDays
Granted, one can consider this a "hack".
Generally and IMO: baking in the property as a Docker label is not great for a few reasons. This data is immutable, which means:
- you can't have different retention policies between repositories which is typical when using image promotion
- e.g. as a product manager, I would like to set retention of 1 month for a
docker-devrepository but the same image - if promoted todocker-production- should be kept for min. 2 years
- e.g. as a product manager, I would like to set retention of 1 month for a
- you can't reliably "pin" a specific image to not be deleted
- not a big deal yet ... it exposes internal information (i.e. that you're internally a user of Artifactory) within the public artifacts you'd make available to the customers