Cleaning Azure Container Registry (ACR) on demand or schedule
- Get link
- X
- Other Apps
In this blog post, we will see how to purge container images from Azure Container Registry (ACR). Till recent time most of them would have written custom PowerShell or bash script and run it to clean (purge) ACR container images. Recently Microsoft introduced a new preview feature to automatically purge images based on filters, duration, and untagged manifests. Additionally, this new preview feature supports to run on-demand or on a schedule using CRON expression.
In my current project, our delivery team is committing code several times a day. This automatically triggers a CI pipeline from which images are automatically built and pushed into ACR. Most of them would be going through the same journey. In this situation using this new preview feature, helps to keep ACR clean and not worrying about the Container registry getting bloated with images.
Both on-demand or schedule will make use of acr purge command. ACR purge is designed to run as a container command in an ACR Task internally it authenticates automatically with the registry where the task runs and performs actions there. Purge command options and capabilities are defined here.
Note: Use the ACR purge command with caution--deleted image data is UNRECOVERABLE.
Comments
Post a Comment