Immutability stops a tag from being overwritten, but not always deleted. A lock, such as Azure's write-enabled and delete-enabled attributes, protects against deletion and updates. Retention rules can still act unless they honour those settings. Check each setting separately, and test it.
Three different protections
| Setting | Stops overwrite | Stops delete | Notes |
|---|---|---|---|
| Tag immutability | Yes | Not by itself in every registry | ECR returns an error when you push an existing tag |
| Lock or delete protection | Yes, if write is disabled | Yes, if delete is disabled | Azure sets attributes per image or repository |
| Keep policy in a cleanup rule | No | Protects from that rule only | Artifact Registry: a keep match wins over a delete match |
What the documentation states
Azure. You can lock an image version or repository so it cannot be deleted or updated, using attributes set with the repository update command. You can also protect from deletion while allowing updates, or block reads. Azure notes tags and manifests have separate attributes: setting delete protection on a tag does not set it on its manifest. Query both. By default the purge command does not delete locked tags or manifests, unless you pass the include locked option.
ECR. Tag immutability makes a push of an existing tag fail with an error. It applies to all tags in the repository, with optional exclusions for a few tags. Lifecycle policies are a separate mechanism that expires images based on rules.
Artifact Registry. If a repository has immutable tags enabled, tagged artifacts cannot be deleted, per its cleanup policy page. Here immutability does block deletion by cleanup.
The same word, immutable, therefore means different things across registries. Read the page for yours.
Why the difference matters
Suppose you rely on immutability to keep a release image safe. In one registry that blocks deletion by cleanup. In another it only prevents overwrite, and a retention rule or an administrator can still delete it. Without testing, you may believe an image is protected when it is not.
A test to run
- Create a throwaway image and apply the protection you rely on.
- Try to overwrite the tag. Record the result.
- Try to delete by tag and by digest. Record the result.
- Run a cleanup rule that would match it, in preview if possible.
Put the findings in your runbook.
Protecting the right things
Protect release images and supported lines, not everything. A locked repository of throwaway builds defeats cleanup. Align protection with the protected set from which images a retention policy should never delete, and see immutable image tags, registry setting or admission policy.
Quick check
Does immutability prevent deletion everywhere?
No. In Artifact Registry it blocks deletion by cleanup, while ECR documents it as preventing overwrites. Test your registry.
Does a locked image get purged?
In Azure, the purge command skips locked tags and manifests by default, unless you pass the include locked option.
Sources
- Lock a container image in Azure Container Registry
- Purge tags and manifests in Azure Container Registry
- Amazon ECR image tag mutability
- Artifact Registry cleanup policies
Last reviewed: 19 October 2026.