Safeguard
Security Guides•

What should you do about old, unused images in your container registry?

Old images in a registry can still be pulled and carry known flaws. A retention policy, tag rules and a cleanup routine reduce what you must defend.

Safeguard Security Team
3 min read

Set a retention policy that deletes images you will not deploy, keep a short list of approved images for production, and block pulls of anything outside it. Every old image is something that could be deployed by mistake and something you must scan, explain and defend.

Why stale images are a risk

A registry accumulates images with every build. Old ones carry vulnerabilities that were unknown when they were built. They can still be pulled by anyone with access, by digest or by an old tag, and a rollback script or a forgotten manifest may do exactly that. The longer the list, the more noise in your scan results.

Decide what to keep

Image classSuggested retention
Currently deployed digestsKeep while deployed
Last few releases for rollbackKeep, within a defined window
Release images needed for support or auditKeep with a documented period
Feature branch and pull request buildsDelete after merge or a short time
Untagged or dangling imagesDelete unless referenced by digest
Images with a known critical issue and a fixed replacementMark deprecated, then delete after migration

Pick the periods that fit your support commitments. Do not copy someone else's numbers.

Cleanup steps

  1. List images and when each was last pulled and pushed.
  2. Cross-check with the digests running in the cluster, so you never delete something live.
  3. Apply retention rules by repository and by tag pattern.
  4. Remember that deleting a tag does not delete the content if other tags or digest references remain. Run the registry's garbage collection or equivalent.
  5. Check for attached SBOMs and signatures, and decide whether they follow the image.
  6. Alert before deletion, and keep a log of what was removed.

Control who can push and pull

Retention only helps if people cannot reintroduce old content. Limit push rights to build systems, and restrict pulls in production to approved repositories. Our post on registry hardening covers access.

Use deprecation before deletion

For widely used internal images, mark a version deprecated, tell consumers, set a date, and watch pull counts fall before deleting. Surprising a team with a vanished image creates pressure to restore it.

Try it yourself

Click through it at your own pace, or open it full screen.

Watch how findings change over time on a component that nobody touches.

Quick check

Does deleting a tag free the image?

Not always. Other tags or digest references can keep the content, and storage is usually reclaimed by garbage collection.

Can I delete an image that rollback might need?

Keep the last few releases within your rollback window. Delete older ones.

Safeguard keeps dependency and SBOM inventories and applies policies; try the free scan.

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.