@Eduards , 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.