Member-only story

How to purge stale images from Azure Container Registry with ACR Tasks and GitHub Actions

Stale container images in Azure Container Registry can waste money in storage costs if you’re not careful. Let’s use ACR Tasks to clean them up and save some money!

Will Velida
9 min readDec 6, 2024

Cleaning up stale images (images that you’re not using) from your Azure Container Registry is important for a couple of reasons. First off, storing images in ACR isn’t free. Even with the Basic SKU, once you go past your 10GB limit, you end up paying $0.00516 AUD (at the time of writing) per GB of additional storage. If you have container images that are just sitting there not being used, it’ll waste money and second, it’ll be difficult to manage your images.

Depending on your build pipeline, you might be building multiple versions of the same image. In my case, I’m using an Azure Subscription with MVP benefits, which gives me around $250 AUD a month to spend on Azure. I don’t want to waste that money, so cleaning up stale images is an important task.

To do this, we can use ACR tasks to clean up stale images. We can also use GitHub Actions to run scripts on a schedule, so this blog post outlines a solution that I’ve created that cleans up all the stale images within all the…

--

--

Will Velida
Will Velida

Written by Will Velida

Lead Software Engineer at Azenix | Ex-MSFT | International Conference Speaker. | GitHub: https://github.com/willvelida

No responses yet