Unable to decrease Container Registry storage

Hannes Sachsenhofer 20 Reputation points
2024-05-06T08:16:16.0333333+00:00

I used the CLI "purge" commands to delete old images (everything older than a year). I can see in the GUI that the old image versions are no longer available. I also enabled the retention period (tried different settings between 0 and 365 days). Soft delete is disabled; it's a "Premium" tier container registry.

But the reported storage still is not going down, even after waiting several weeks, even tho the "purge" command removed a lot of images from several years. I tried with two different registries in two different tenants, both with the same (aka none) result.

How can I decrease the used/reported storage in our Container Registries?

Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
446 questions
{count} votes

Accepted answer
  1. Charlie Wei 3,320 Reputation points
    2024-05-06T12:37:56.3566667+00:00

    Hello Hannes Sachsenhofer,

    As Prrudram-MSFT mentioned, you can use the command az acr show-usage. An example output of this command is provided below, which allows you to compare the differences in value[0].currentValue before and after executing the acr purge command.

    {
      "value": [
        {
          "currentValue": 3564,
          "limit": 10737418240,
          "name": "Size",
          "unit": "Bytes"
        },
        {
          "currentValue": 0,
          "limit": 2,
          "name": "Webhooks",
          "unit": "Count"
        },
        {
          "currentValue": 0,
          "limit": 100,
          "name": "ScopeMaps",
          "unit": "Count"
        },
        {
          "currentValue": 0,
          "limit": 100,
          "name": "Tokens",
          "unit": "Count"
        }
      ]
    }
    

    Additionally, you can pair this with the following command to individually list the sizes occupied by each image, helping you understand the status of image deletions.

    az acr manifest list-metadata --registry <your_acr_name> --name hello-world --query '[].{Size: imageSize, Digest:digest, Tags: tags}'
    

    Best regards,
    Charlie


    If you find my response helpful, please consider accepting this answer and voting yes to support the community. Thank you!

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Prrudram-MSFT 24,366 Reputation points
    2024-05-06T11:42:45.6033333+00:00

    Hello @Hannes Sachsenhofer

    Thank you for reaching out to the Microsoft Q&A platform

    It's great to hear that you have already tried to delete old images using the purge command and enabled the retention period. However, it's important to note that the storage usage reported in the Azure portal is not updated in real-time. It can take up to 24 hours for the storage usage to be updated after you delete images from your registry. If you have waited for more than 24 hours and still see no change in the storage usage, there might be other factors that are contributing to the storage usage. Here are some things you can check to troubleshoot this issue.

    1. Check if there are any untagged images in your registry. Untagged images are not deleted by the purge command and can take up storage space.
    2. Check if there are any images that are still being used by running containers. If an image is being used by a running container, it cannot be deleted. You can check if there are any running containers using the docker ps command.
    3. Check if there are any images that are still being referenced by other images. If another image is referencing an image, it cannot be deleted. You can check if there are any images that are referencing other images using the az acr repository show-manifests command(I am unsure if this is deprecated but you can give it a try). If you have checked all the above and still see no change in the storage usage, you can try contacting Azure support for further assistance.

    Hope this helps! Let me know the update.

    If I have answered your query, please click "Accept as answer" as a token of appreciation


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.