Home

ACR purge based on number of containers

%3CLINGO-SUB%20id%3D%22lingo-sub-1121123%22%20slang%3D%22en-US%22%3EACR%20purge%20based%20on%20number%20of%20containers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1121123%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20need%20to%20define%20a%20number%20of%20containers%20to%20keep%20rather%20than%20purging%20based%20on%20age.%20I%20found%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcontainer-registry%2Fcontainer-registry-auto-purge%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ean%20article%3C%2FA%3E%20about%20creating%20a%20task%20but%20it%20only%20seems%20to%20support%20removal%20by%20age.%20Searching%20further%20I%20found%20a%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fgoyalmohit%2Facr-cleanup%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EGitHub%20project%3C%2FA%3E%26nbsp%3Bwhich%20would%20do%20the%20job%20but%20I%20was%20wondering%20what%20the%20best%20way%20to%20implement%20this%20might%20be.%20I%20don't%20want%20to%20spin%20up%20a%20VM%20just%20for%20this%20job%20to%20execute%20so%20I%20considered%20a%20container%20scheduled%20to%20start%2C%20run%20the%20script%2C%20and%20then%20stop.%20But%20is%20there%20anyway%20I%20can%20create%20some%20sort%20of%20scheduled%20task%20within%20Azure%20itself%20to%20run%20this%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1121123%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EACR%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ETasks%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Frequent Visitor

I have a need to define a number of containers to keep rather than purging based on age. I found an article about creating a task but it only seems to support removal by age. Searching further I found a GitHub project which would do the job but I was wondering what the best way to implement this might be. I don't want to spin up a VM just for this job to execute so I considered a container scheduled to start, run the script, and then stop. But is there anyway I can create some sort of scheduled task within Azure itself to run this?