Skip to content

Commit ea5afef

Browse files
authored
Merge pull request #88015 from dlepow/acrretention
[ACR] Retention policy article
2 parents c707527 + 1e48015 commit ea5afef

File tree

6 files changed

+108
-5
lines changed

6 files changed

+108
-5
lines changed

articles/container-registry/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
items:
7272
- name: Delete image data - CLI
7373
href: container-registry-delete.md
74+
- name: Retention policy for untagged manifests (preview)
75+
href: container-registry-retention-policy.md
7476
- name: Automatically purge tags and manifests (preview)
7577
href: container-registry-auto-purge.md
7678
- name: Upgrade a Classic registry

articles/container-registry/container-registry-concepts.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: dlepow
66

77
ms.service: container-registry
88
ms.topic: article
9-
ms.date: 07/01/2019
9+
ms.date: 09/10/2019
1010
ms.author: danlep
1111
---
1212

@@ -90,7 +90,7 @@ Each container image or artifact pushed to a container registry is associated wi
9090
az acr repository show-manifests --name <acrName> --repository <repositoryName>
9191
```
9292

93-
For example, list the manifest digests for the "acr-helloworld" repository:
93+
For example, list the manifests for the "acr-helloworld" repository:
9494

9595
```console
9696
$ az acr repository show-manifests --name myregistry --repository acr-helloworld
@@ -133,8 +133,7 @@ $ docker pull myregistry.azurecr.io/acr-helloworld@sha256:0a2e01852872580b2c2fea
133133
```
134134

135135
> [!IMPORTANT]
136-
> If you repeatedly push modified images with identical tags, you might create orphaned images--images that are untagged, but still consume space in your registry. Untagged images are not shown in the Azure CLI or in the Azure portal when you list or view images by tag. However, their layers still exist and consume space in your registry. For information about freeing space used by untagged images, see [Delete container images in Azure Container Registry](container-registry-delete.md).
137-
136+
> If you repeatedly push modified images with identical tags, you might create orphaned images--images that are untagged, but still consume space in your registry. Untagged images are not shown in the Azure CLI or in the Azure portal when you list or view images by tag. However, their layers still exist and consume space in your registry. Deleting an untagged image frees registry space when the manifest is the only one, or the last one, pointing to a particular layer. For information about freeing space used by untagged images, see [Delete container images in Azure Container Registry](container-registry-delete.md).
138137
139138
## Next steps
140139

articles/container-registry/container-registry-content-trust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Content trust in Azure Container Registry
3-
description: Learn how enable content trust for your Azure container registry, and push and pull signed images.
3+
description: Learn how to enable content trust for your Azure container registry, and push and pull signed images.
44
services: container-registry
55
author: dlepow
66
manager: gwallace

articles/container-registry/container-registry-delete.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,13 @@ if ($enableDelete) {
255255
}
256256
```
257257

258+
258259
## Automatically purge tags and manifests (preview)
259260

260261
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).
261262

263+
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.
264+
262265
## Next steps
263266

264267
For more information about image storage in Azure Container Registry see [Container image storage in Azure Container Registry](container-registry-storage.md).
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
title: Policy to retain untagged manifests in Azure Container Registry
3+
description: Learn how to enable a retention policy in your Azure container registry, for automatic deletion of untagged manifests after a defined period.
4+
services: container-registry
5+
author: dlepow
6+
manager: gwallace
7+
8+
ms.service: container-registry
9+
ms.topic: article
10+
ms.date: 09/25/2019
11+
ms.author: danlep
12+
---
13+
14+
# Set a retention policy for untagged manifests
15+
16+
Azure Container Registry gives you the option to set a *retention policy* for stored image manifests that don't have any associated tags (*untagged manifests*). When a retention policy is enabled, untagged manifests in the registry are automatically deleted after a number of days you set. This feature prevents the registry from filling up with artifacts that aren't needed and helps you save on storage costs. If the `delete-enabled` attribute of an untagged manifest is set to `false`, the manifest can't be deleted, and the retention policy doesn't apply.
17+
18+
You can use the Azure Cloud Shell or a local installation of the Azure CLI to run the command examples in this article. If you'd like to use it locally, version 2.0.74 or later is required. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI][azure-cli].
19+
20+
> [!IMPORTANT]
21+
> This feature is currently in preview, and some [limitations apply](#preview-limitations). 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).
22+
23+
> [!WARNING]
24+
> Set a retention policy with care--deleted image data is UNRECOVERABLE. If you have systems that pull images by manifest digest (as opposed to image name), you should not set a retention policy for untagged manifests. 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).
25+
26+
If you want to delete single image tags or manifests using Azure CLI commands, see [Delete container images in Azure Container Registry](container-registry-delete.md).
27+
28+
## Preview limitations
29+
30+
* Only a **Premium** container registry can be configured with a retention policy. For information about registry service tiers, see [Azure Container Registry SKUs](container-registry-skus.md).
31+
* You can only set a retention policy for untagged manifests.
32+
33+
## Set a retention policy - CLI
34+
35+
The following example shows you how to use the Azure CLI to set a retention policy for untagged manifests in a registry.
36+
37+
### Enable a retention policy
38+
39+
By default, no retention policy is set in a container registry. To set or update a retention policy, run the [az acr config retention update][az-acr-config-retention-update] command in the Azure CLI. You can specify a number of days between 0 and 365 to retain the untagged manifests. If you don't specify a number of days, the command sets a default of 7 days. After the retention period, all untagged manifests in the registry are automatically deleted.
40+
41+
The following example sets a retention policy of 30 days for untagged manifests in the registry *myregistry*:
42+
43+
```azurecli
44+
az acr config retention update --name myregistry --status enabled --days 30 --type UntaggedManifests
45+
```
46+
47+
The following example sets a policy to delete any manifest in the registry as soon as it's untagged. Create this policy by setting a retention period of 0 days:
48+
49+
```azurecli
50+
az acr config retention update --name myregistry --status enabled --days 0 --type UntaggedManifests
51+
```
52+
53+
### Disable a retention policy
54+
55+
To see the retention policy set in a registry, run the [az acr config retention show][az-acr-config-retention-show] command:
56+
57+
```azurecli
58+
az acr config retention show --name myregistry
59+
```
60+
61+
To disable a retention policy in a registry, run the [az acr config retention update][az-acr-config-retention-update] command and set `--status disabled`:
62+
63+
```azurecli
64+
az acr config retention update --name myregistry --status disabled
65+
```
66+
67+
## Set a retention policy - portal
68+
69+
You can also set a registry's retention policy in the [Azure portal](https://portal.azure.com). The following example shows you how to use the portal to set a retention policy for untagged manifests in a registry.
70+
71+
### Enable a retention policy
72+
73+
1. Navigate to your Azure container registry. Under **Policies**, select **Retention** (Preview).
74+
1. In **Status**, select **Enabled**.
75+
1. Select a number of days between 0 and 365 to retain the untagged manifests. Select **Save**.
76+
77+
![Enable a retention policy in Azure portal](media/container-registry-retention-policy/container-registry-retention-policy01.png)
78+
79+
### Disable a retention policy
80+
81+
1. Navigate to your Azure container registry. Under **Policies**, select **Retention** (Preview).
82+
1. In **Status**, select **Disabled**. Select **Save**.
83+
84+
## Next steps
85+
86+
* Learn more about options to [delete images and repositories](container-registry-delete.md) in Azure Container Registry
87+
88+
* Learn how to [automatically purge](container-registry-auto-purge.md) selected images and manifests from a registry
89+
90+
* Learn more about options to [lock images and manifests](container-registry-image-lock.md) in a registry
91+
92+
<!-- LINKS - external -->
93+
[terms-of-use]: https://azure.microsoft.com/support/legal/preview-supplemental-terms/
94+
95+
96+
<!-- LINKS - internal -->
97+
[azure-cli]: /cli/azure/install-azure-cli
98+
[az-acr-config-retention-update]: /cli/azure/acr/config/retention#az-acr-config-retention-update
99+
[az-acr-config-retention-show]: /cli/azure/acr/config/retention#az-acr-config-retention-show
175 KB
Loading

0 commit comments

Comments
 (0)