Safeguard
Security Guides•

Lock, protect or immutable: what actually stops image deletion?

Tag immutability stops overwrites, locks stop deletes and updates, and retention rules delete. How each setting works in ACR, ECR and Artifact Registry.

Safeguard Security Team
3 min read

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

SettingStops overwriteStops deleteNotes
Tag immutabilityYesNot by itself in every registryECR returns an error when you push an existing tag
Lock or delete protectionYes, if write is disabledYes, if delete is disabledAzure sets attributes per image or repository
Keep policy in a cleanup ruleNoProtects from that rule onlyArtifact 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

  1. Create a throwaway image and apply the protection you rely on.
  2. Try to overwrite the tag. Record the result.
  3. Try to delete by tag and by digest. Record the result.
  4. 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

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.