Docker cleanup policy based on tags

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.

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.

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