You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/container-registry/container-registry-auto-purge.md
+1-4Lines changed: 1 addition & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Purge tags and manifests
3
3
description: Use a purge command to delete multiple tags and manifests from an Azure container registry based on age and a tag filter, and optionally schedule purge operations.
4
4
ms.topic: article
5
-
ms.date: 02/19/2021
5
+
ms.date: 05/07/2021
6
6
---
7
7
8
8
# Automatically purge images from an Azure container registry
@@ -13,9 +13,6 @@ The `acr purge` command is currently distributed in a public container image (`m
13
13
14
14
You can use the Azure Cloud Shell or a local installation of the Azure CLI to run the ACR task examples in this article. If you'd like to use it locally, version 2.0.76 or later is required. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI][azure-cli-install].
15
15
16
-
> [!IMPORTANT]
17
-
> This feature is currently in preview. Previews are made available to you on the condition that you agree to the [supplemental terms of use][terms-of-use]. Some aspects of this feature may change prior to general availability (GA).
18
-
19
16
> [!WARNING]
20
17
> Use the `acr purge` command with caution--deleted image data is UNRECOVERABLE. If you have systems that pull images by manifest digest (as opposed to image name), you should not purge untagged images. Deleting untagged images will prevent those systems from pulling the images from your registry. Instead of pulling by manifest, consider adopting a *unique tagging* scheme, a [recommended best practice](container-registry-image-tag-version.md).
Copy file name to clipboardExpand all lines: articles/container-registry/container-registry-delete.md
+13-76Lines changed: 13 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,10 @@
2
2
title: Delete image resources
3
3
description: Details on how to effectively manage registry size by deleting container image data using Azure CLI commands.
4
4
ms.topic: article
5
-
ms.date: 07/31/2019
5
+
ms.date: 05/07/2021
6
6
---
7
7
8
-
# Delete container images in Azure Container Registry using the Azure CLI
8
+
# Delete container images in Azure Container Registry
9
9
10
10
To maintain the size of your Azure container registry, you should periodically delete stale image data. While some container images deployed into production may require longer-term storage, others can typically be deleted more quickly. For example, in an automated build and test scenario, your registry can quickly fill with images that might never be deployed, and can be purged shortly after completing the build and test pass.
11
11
@@ -15,10 +15,11 @@ Because you can delete image data in several different ways, it's important to u
15
15
* Delete by [tag](#delete-by-tag): Deletes an image, the tag, all unique layers referenced by the image, and all other tags associated with the image.
16
16
* Delete by [manifest digest](#delete-by-manifest-digest): Deletes an image, all unique layers referenced by the image, and all tags associated with the image.
17
17
18
-
Sample scripts are provided to help automate delete operations.
19
-
20
18
For an introduction to these concepts, see [About registries, repositories, and images](container-registry-concepts.md).
21
19
20
+
> [!NOTE]
21
+
> After you delete image data, Azure Container Registry stops billing you immediately for the associated storage. However, the registry recovers the associated storage space using an asynchronous process. It takes some time before the registry cleans up layers and shows the updated storage usage.
22
+
22
23
## Delete repository
23
24
24
25
Deleting a repository deletes all of the images in the repository, including all tags, unique layers, and manifests. When you delete a repository, you recover the storage space used by the images that reference unique layers in that repository.
@@ -102,7 +103,7 @@ The `acr-helloworld:v2` image is deleted from the registry, as is any layer data
102
103
103
104
To maintain the size of a repository or registry, you might need to periodically delete manifest digests older than a certain date.
104
105
105
-
The following Azure CLI command lists all manifest digest in a repository older than a specified timestamp, in ascending order. Replace `<acrName>` and `<repositoryName>` with values appropriate for your environment. The timestamp could be a full date-time expression or a date, as in this example.
106
+
The following Azure CLI command lists all manifest digests in a repository older than a specified timestamp, in ascending order. Replace `<acrName>` and `<repositoryName>` with values appropriate for your environment. The timestamp could be a full date-time expression or a date, as in this example.
106
107
107
108
```azurecli
108
109
az acr repository show-manifests --name <acrName> --repository <repositoryName> \
@@ -196,85 +197,21 @@ As mentioned in the [Manifest digest](container-registry-concepts.md#manifest-di
196
197
197
198
As you can see in the output of the last step in the sequence, there is now an orphaned manifest whose `"tags"` property is an empty list. This manifest still exists within the registry, along with any unique layer data that it references. **To delete such orphaned images and their layer data, you must delete by manifest digest**.
198
199
199
-
## Delete all untagged images
200
-
201
-
You can list all untagged images in your repository using the following Azure CLI command. Replace `<acrName>` and `<repositoryName>` with values appropriate for your environment.
202
-
203
-
```azurecli
204
-
az acr repository show-manifests --name <acrName> --repository <repositoryName> --query "[?tags[0]==null].digest"
205
-
```
206
-
207
-
Using this command in a script, you can delete all untagged images in a repository.
208
-
209
-
> [!WARNING]
210
-
> Use the following sample scripts with caution--deleted image data is UNRECOVERABLE. If you have systems that pull images by manifest digest (as opposed to image name), you should not run these scripts. Deleting untagged images will prevent those systems from pulling the images from your registry. Instead of pulling by manifest, consider adopting a *unique tagging* scheme, a [recommended best practice](container-registry-image-tag-version.md).
211
-
212
-
**Azure CLI in Bash**
213
-
214
-
The following Bash script deletes all untagged images from a repository. It requires the Azure CLI and **xargs**. By default, the script performs no deletion. Change the `ENABLE_DELETE` value to `true` to enable image deletion.
The following PowerShell script deletes all untagged images from a repository. It requires PowerShell and the Azure CLI. By default, the script performs no deletion. Change the `$enableDelete` value to `$TRUE` to enable image deletion.
Azure Container Registry provides the following automated methods to remove tags and manifests, and their associated unique layer data:
267
203
204
+
* Create an ACR task that runs the `acr purge` container command to delete all tags that are older than a certain duration or match a specified name filter. Optionally configure `acr purge` to delete untagged manifests.
268
205
269
-
## Automatically purge tags and manifests (preview)
206
+
For more information, see [Automatically purge images from an Azure container registry](container-registry-auto-purge.md).
270
207
271
-
As an alternative to scripting Azure CLI commands, run an on-demand or scheduled ACR task to delete all tags that are older than a certain duration or match a specified name filter. For more information, see [Automatically purge images from an Azure container registry](container-registry-auto-purge.md).
208
+
* Optionally set a [retention policy](container-registry-retention-policy.md) for each registry, to manage untagged manifests. When you enable a retention policy, image manifests in the registry that don't have any associated tags, and the underlying layer data, are automatically deleted after a set period.
272
209
273
-
Optionally set a [retention policy](container-registry-retention-policy.md) for each registry, to manage untagged manifests. When you enable a retention policy, image manifests in the registry that don't have any associated tags, and the underlying layer data, are automatically deleted after a set period.
210
+
The retention policy is currently a preview feature of **Premium** container registries. The retention policy applies to untagged manifests created after the policy takes effect.
274
211
275
212
## Next steps
276
213
277
-
For more information about image storage in Azure Container Registry see [Container image storage in Azure Container Registry](container-registry-storage.md).
214
+
For more information about image storage in Azure Container Registry, see [Container image storage in Azure Container Registry](container-registry-storage.md).
0 commit comments