Azure Container Registry image purge is not reflected in SKU

Viewed 355

I'm running az acr purge to retain old Docker Images in my ACR. I can see in the output that tags are being deleted in repository and they are no longer visible in Azure Portal ACR repository explorer.

The problem I'm facing is the SKU usage is not decreasing.

ACR SKU Usage

This is one of the many operations that have deleted some docker images. The command is visible in 2nd line.

Running command on Azure Container Registry
acr purge --filter 'my_docker_repository:(\d+\.\d+.\d+.\d+)-\S*' --ago 180d
2021/08/13 09:48:11 Alias support enabled for version >= 1.1.0, please see https://aka.ms/acr/tasks/task-aliases for more information.
2021/08/13 09:48:11 Creating Docker network: acb_default_network, driver: 'bridge'
2021/08/13 09:48:11 Successfully set up Docker network: acb_default_network
2021/08/13 09:48:11 Setting up Docker configuration...
2021/08/13 09:48:12 Successfully set up Docker configuration
2021/08/13 09:48:12 Logging in to registry: my_very_secret_acr.azurecr.io
2021/08/13 09:48:13 Successfully logged into my_very_secret_acr.azurecr.io
2021/08/13 09:48:13 Executing step ID: acb_step_0. Timeout(sec): 600, Working directory: '', Network: 'acb_default_network'
2021/08/13 09:48:13 Launching container with name: acb_step_0
Deleting tags for repository: my_docker_repository
my_very_secret_acr.azurecr.io/my_docker_repository:2020.12.15.895-RefsPull13776Merge-f101d12
my_very_secret_acr.azurecr.io/my_docker_repository:2021.2.11.1478-IeltsResultsDevelop-0a6c82a
my_very_secret_acr.azurecr.io/my_docker_repository:2021.2.11.1478-RefsPull14181Merge-3c41e76
my_very_secret_acr.azurecr.io/my_docker_repository:2021.2.11.1473-IeltsResultsDevelop-b06f9a3
my_very_secret_acr.azurecr.io/my_docker_repository:2021.2.11.1473-RefsPull14168Merge-1fec456
my_very_secret_acr.azurecr.io/my_docker_repository:2021.2.11.1472-RefsPull14168Merge-0f61afd
my_very_secret_acr.azurecr.io/my_docker_repository:2021.2.11.1463-IeltsResultsDevelop-9a6c4b7
my_very_secret_acr.azurecr.io/my_docker_repository:2021.2.11.1461-RefsPull13734Merge-e0f2caa
my_very_secret_acr.azurecr.io/my_docker_repository:2021.2.11.1461-RefsPull14135Merge-ff95d1f
my_very_secret_acr.azurecr.io/my_docker_repository:2021.2.11.1434-RefsPull13734Merge-20af0dd
Number of deleted tags: 10
Number of deleted manifests: 0
2021/08/13 09:48:14 Successfully executed container: acb_step_0
2021/08/13 09:48:14 Step ID: acb_step_0 marked as successful (elapsed time in seconds: 1.172114)
Run ID: cb7f was successful after 5s

Update #1

Running

az acr repository delete

works like a charm, no modification must be done beforehand


I'm following these guides

1 Answers

Blockquote

Based on the filter command used ,only tag references are deleted, not the underlying manifests and layer data as it is Write enabled.

acr purge does not delete an image tag or repository where the write-enabled attribute is set to false

az acr repository show \  
--name myregistry --image image:tag \  
--output jsonc
 az acr repository update \  
--name myregistry --image myrepo/myimage:tag \  
--delete-enabled true --write-enabled true
  • To delete the image, repository and manifest to free up SKU size . Please follow the link to delete the manifest and data.

  • Alternatively, if you want to delete the image, tags & manifest using the acr purge you need to pass the acr purge command as an environment variable as explained in the above documentation

Related