Docker cleanup policy based on tags - Sonatype Nexus Repository / Best Practices - Sonatype Community

Docker cleanup policy based on tags

post by mohammadbagher72moussavi on Jan 24, 2022

Hi, As I see in creating “cleanup policy”, I only can set “Remove components that were published over N days ago” or “Remove components that haven’t been downloaded in N days”.

But I need to for example have last 20 tags of every single docker image.

How can I set this policy?

Thank you.

post by mmartz on Jan 24, 2022

I’m wondering what you mean when you say the last 20 tags? Are you including the “latest” tag in that count? Right now there is no way to have a cleanup policy to do what you’re looking for. You could probably use the REST API to lookup and remove docker images on a regular basis, but that’s really just a stopgap until it’s available in product.

post by mpiggott on Jan 24, 2022

You may want to follow this ticket - NEXUS-10821 Restore retain/keep only the last X versions - Sonatype JIRA.