Safeguard
Security Guides•

Should you enable delete on a self-hosted Docker registry?

storage.delete.enabled is off by default. Turn it on for cleanup, but control who can delete and know disk is not freed until garbage collection runs.

Safeguard Security Team
3 min read

Enable delete if you need to remove images, because without it the registry only grows. The setting storage.delete.enabled defaults to false. Turning it on lets clients delete blobs and manifests by digest, so pair it with tight access control and a plan for garbage collection.

What the setting does

In the registry configuration, storage.delete.enabled controls whether deleting blobs and manifests by digest is allowed. The default is false. With it off, a delete call is refused. The OCI distribution spec says a registry that has deletion disabled must answer with 400 or 405.

The pull-through cache guide adds a related point: cleanup of cached content requires delete to be enabled in the registry configuration.

Why it is off by default

A registry that cannot delete is simple to reason about. Nothing disappears by accident or by a stolen credential. Once delete is on, anyone with write rights could remove a production image, and your next rollout or autoscale event would fail to pull it.

That is an availability risk, and it also hides evidence. If an incident responder needs the image that ran last week, deletion removes it.

Delete is two steps, not one

Deleting through the API removes the reference and makes the target unreadable through the API. The data stays on disk until garbage collection runs. So two things follow.

  • Turning on delete does not free space by itself.
  • Disk usage stays flat after a cleanup job until you run collection.

Also, layers are shared. A layer is only collected when no manifest references it, so deleting one image may free little if its layers are used elsewhere.

A sensible approach

  1. Decide the owner. One service account, run by the platform team, performs deletes through a scheduled job. Developers do not delete by hand.
  2. Define a retention rule before you automate. Keep released versions and anything currently deployed. Expire untagged and old build images.
  3. Record what is removed. Log the repository and digest before each delete so you can answer questions later.
  4. Take a backup of the registry storage before the first large cleanup.
  5. Schedule garbage collection in a maintenance window, since the docs describe it as stop the world.
  6. Test in a copy of the registry first.
SettingEffectRisk if careless
delete disabledRegistry only growsDisk fills up
delete enabled, no controlsAnyone with write can remove imagesOutage or lost evidence
delete enabled, one owner, loggedControlled cleanupLow, if retention is correct

What to check after

Run a pull of a few known good images by digest. Check that deployed workloads still resolve their references. Confirm disk usage fell after collection, not before it.

If you want to see what your images contain before you decide what to keep, Safeguard can scan container images and generate SBOMs, with a free scan at gold.safeguard.sh/scan.

Quick check

Does deleting an image free disk space right away?

No. The data stays on disk until garbage collection runs, and shared layers stay as long as another manifest uses them.

What does a registry return when delete is disabled?

The OCI distribution spec says it must respond with 400 or 405.

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.