Open exitista opened 5 years ago
@SteveLasker - should we enhance to count rather than ago ? https://docs.microsoft.com/en-us/azure/container-registry/container-registry-auto-purge
@SteveLasker /cc @sajayantony
Any luck with this request? When this will be implemented?
Thanks for any update on this - I am having to write something custom for this at the moment.
Any update here? Thanks!
Any update on this?
They added a --keep
flag, but I get unknow flag, so has this been implemented?
https://docs.microsoft.com/en-us/azure/container-registry/container-registry-auto-purge#use-the-purge-command
Thanks
Any progress here? Something like this could really help me out. I'd like to be able to set a rule like e.g: Allow a maximum of 5 images in a repository. If a sixth image is added, delete the oldest one.
Any progress here? Something like this could really help me out. I'd like to be able to set a rule like e.g: Allow a maximum of 5 images in a repository. If a sixth image is added, delete the oldest one.
PURGE_CMD="mcr.microsoft.com/acr/acr-cli:0.4 purge \
--filter 'samples/devimage1:.*' --filter 'samples/devimage2:.*' \
--ago 0d --keep 5 --untagged"
az acr task create --name weeklyPurgeTask \
--cmd "$PURGE_CMD" \
--schedule "0 1 * * Sun" \
--registry myregistry \
--context /dev/null
You can create a task that will clean it out every week. More info: https://docs.microsoft.com/en-us/azure/container-registry/container-registry-auto-purge#example-scheduled-purge-of-multiple-repositories-in-a-registry The important bit is to add the --keep 5 part to the command
Not that I am aware of and I also have moved on at this point, implementing a custom script.
From: themegaphoenix @.> Sent: Wednesday, September 22, 2021 4:49 AM To: Azure/acr @.> Cc: Maurice williams @.>; Comment @.> Subject: Re: [Azure/acr] delete all images in Azure Container Registry except the last two (#264)
Any progress here? Something like this could really help me out. I'd like to be able to set a rule like e.g: Allow a maximum of 5 images in a repository. If a sixth image is added, delete the oldest one.
PURGE_CMD="mcr.microsoft.com/acr/acr-cli:0.4 purge \ --filter 'samples/devimage1:.' --filter 'samples/devimage2:.' \ --ago 0d --keep 5 --untagged"
az acr task create --name weeklyPurgeTask \ --cmd "$PURGE_CMD" \ --schedule "0 1 Sun" \ --registry myregistry \ --context /dev/null```
You can create a task that will clean it out every week. More info: https://docs.microsoft.com/en-us/azure/container-registry/container-registry-auto-purge#example-scheduled-purge-of-multiple-repositories-in-a-registryhttps://urldefense.com/v3/__https://docs.microsoft.com/en-us/azure/container-registry/container-registry-auto-purge*example-scheduled-purge-of-multiple-repositories-in-a-registry__;Iw!!AKgNyAfk550h-spHnEo!KHGkaSqvo-DTtlfvJGloCne3Vfwj-pToW0Cvj-0SD-4eS4Ij5YR9enNlIjLwrpO05CU$
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/Azure/acr/issues/264*issuecomment-924719120__;Iw!!AKgNyAfk550h-spHnEo!KHGkaSqvo-DTtlfvJGloCne3Vfwj-pToW0Cvj-0SD-4eS4Ij5YR9enNlIjLwDyHEYMg$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ALSGMF576TDOATX3253B5FLUDGKCHANCNFSM4IN3XB4Q__;!!AKgNyAfk550h-spHnEo!KHGkaSqvo-DTtlfvJGloCne3Vfwj-pToW0Cvj-0SD-4eS4Ij5YR9enNlIjLwmhVKr_w$. Triage notifications on the go with GitHub Mobile for iOShttps://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!AKgNyAfk550h-spHnEo!KHGkaSqvo-DTtlfvJGloCne3Vfwj-pToW0Cvj-0SD-4eS4Ij5YR9enNlIjLw5q2Vf3k$ or Androidhttps://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign*3Dnotification-email*26utm_medium*3Demail*26utm_source*3Dgithub__;JSUlJSU!!AKgNyAfk550h-spHnEo!KHGkaSqvo-DTtlfvJGloCne3Vfwj-pToW0Cvj-0SD-4eS4Ij5YR9enNlIjLwT-ZRV9E$.
Disclaimer: This email and any attachments are sent in strictest confidence for the sole use of the addressee and may contain legally privileged, confidential, and proprietary data. If you are not the intended recipient, please advise the sender by replying promptly to this email and then delete and destroy this email and any attachments without any further use, copying or forwarding.
Not that I am aware of and I also have moved on at this point, implementing a custom script.
please see my reply above
@themegaphoenix We are investing in an auto-purge capability that will allow you to define the purge policy based on various criteria including keeping certain number of images. Unfortunately, though because of other priorities we had to de-prioritize that work and now the ETA is mid 2022. We do not have plans to enhance the current purge
command with additional capabilities before that. Your option will be to write a custom script to determine the images you want to keep.
@toddysm: Do you have any example on how to achieve this? I tried doing this using the --filter
argument with a positive lookahead (to basically delete everything except). E.g:
apollo:(?!1302|1301|1304)
Which should return everything except the tags 1302
, 1301
and 1304
. But the regex library used by Go doesn't support positive lookahead:
invalid or unsupported Perl syntax: `(?!`
The only way I can think of is getting a list of the tags and run the delete by tag myself. I'm wondering if you have any other ideas.. ;-)
What is the status of this?
How can it take almost 4 years??? This is crazy!!!
What is the status of this?
it has been implemented.
acr purge --keep 10
Hello, how are you?
I want to delete all images in Azure Container Registry except the last two. I was looking for an script for do so but I only find to delete images older than X days. This is not possible for my situation because some days there are a lot of images created and other days only one.
Somebody has any idea?
Thanks in advance
Regards