question

Eduards-6654 avatar image
0 Votes"
Eduards-6654 asked srbose-msft edited

Azure ACR automatic cleaning

Hello,

Currently we are configuring Azure ACR and it has some repositories each of repository consists of images.

Images are locked and tagged in incremental by numbers. Every time developers push their code, an image is created in Azure ACR repository.

We need to configure cleaning of this image, but we can't delete everything because there is a chance that image will contain some information needed for development.

  1. Is there possibility to monitor used space by repository? - I can see used space on all Azure ACR, but I need to see and repository instead.

  2. How could I automate repository image cleaning? - for steps would be (1. unlock image, 2. un-tag image 3. purge image 4. purge is initiated by date) - this probably is not possible from azure UI interface? Azure CLI?

  3. How could I identify that I could remove this Image and that would not damage all production environment?

  4. Also this should be monitored by used space and make alerting to notify users, that it's time to clean up some space in repo.


Thanks.

azure-monitorazure-container-instances
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

srbose-msft avatar image
0 Votes"
srbose-msft answered srbose-msft edited

@Eduards-6654 , thank you for your question.

1. Is there possibility to monitor used space by repository? - I can see used space on all Azure ACR, but I need to see and repository instead.

At the time of writing, there is no out of the box metric for spaced used by an ACR repository granularly. The available metrics in the Container registry standard metrics namespace are:

Metric Exportable via Diagnostic Settings? Unit Aggregation Type Description Dimensions
AgentPoolCPUTime Yes Seconds Total CPU time used by ACR tasks running on dedicated agent pools None
RunDuration Yes Milliseconds Total Duration of ACR tasks runs None
StorageUsed No Bytes Average Storage used by the container registry. Sum of storage for unique and shared layers, manifest files, and replica copies in all repositories** Geolocation
SuccessfulPullCount Yes Count Total Successful pulls of container images and other artifacts from the registry None
SuccessfulPushCount Yes Count Total Successful pushes of container images and other artifacts to the registry None
TotalPullCount Yes Count Total Total pulls of container images and other artifacts from the registry None
TotalPushCount Yes Count Total Total pushes of container images and other artifacts to the registry None

**Because of layer sharing, registry storage used may be less than the sum of storage for individual repositories. When you delete a repository or tag, you recover only the storage used by manifest files and the unique layers referenced.

For more information please check here.

2. How could I automate repository image cleaning? - for steps would be (1. unlock image, 2. un-tag image 3. purge image 4. purge is initiated by date) - this probably is not possible from azure UI interface? Azure CLI?

Again, there is no out of the box automation mechanism for all of this from Azure. However, you can write your own steps in scripts using Azure CLI. Following are the references:

.

3. How could I identify that I could remove this Image and that would not damage all production environment?

Please check out the Recommendations for tagging and versioning container images.

4. Also this should be monitored by used space and make alerting to notify users, that it's time to clean up some space in repo.

From 1. currently, there is no out of the box metric for spaced used by an ACR repository granularly. However, here's an example of how to Send email alert when registry storage used exceeds a value


Hope this helps.

Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.