Registry manifest reachability and garbage collection
Reason about shared layers, retained manifests and rollback references before evaluating a registry garbage-collection plan.
TL;DR: Removing a release reference and reclaiming its bytes are separate operations. A shared layer must remain while retained manifests still need it, and a digest recorded in a deployment file does not itself preserve the registry object.
Draw the retained graph
A tag points at a manifest; an image manifest references a configuration blob and layers. An index can reference several platform manifests. Start cleanup planning with those references, then apply the registry product's retention rules. OCI's distribution specification defines the objects and API behavior; it does not prescribe one retention policy for every registry.
This is a simplified graph; configuration blobs and multi-platform indexes are omitted for readability. If manifest two remains a rollback candidate, application two is still needed. If manifest two is removed under an approved policy, the shared base remains because manifest one references it. The rollback label in this drawing represents an explicit retention decision, not an automatic feature inferred from a deployment file.
Separate three questions
First ask which releases must remain retrievable. Include the rollback window and supported architectures. Next determine which references the product will remove. Finally estimate which stored objects become unreferenced. Deleting half the tags cannot establish a fifty-percent storage saving.
For self-managed Distribution, the documented collector marks referenced content and then sweeps unmarked blobs. Its operating procedure requires the registry to be stopped or read-only during collection; concurrent uploads can otherwise be damaged. A dry run reports candidates without removing them. Managed services may implement different collection mechanisms, so use their own runbook. Distribution garbage collection
Review a cleanup proposal
In this tabletop exercise, a registry stores ten releases sharing a large base layer. The service team needs the current and previous two releases for rollback. An operator proposes deleting every untagged object because deployment manifests use digests.
Reject the proposal until it accounts for those digests and their reachable objects. Untagged does not mean unused by a deployment. Build a retained-release list from the service's policy, map each release to its index or manifest, and check every supported platform. Include associated signatures or attestations required by the admission policy when reviewing the product's retention behavior.
Estimate reclaimed bytes from unique, unreferenced blobs. Keep the estimate separate from observed storage billing, which can include backend versioning or delayed cleanup. On an isolated fixture registry, verify retained releases can be pulled after cleanup from an empty client cache; a running container or warm cache cannot prove registry availability.
Check your understanding
Why does deleting one of two manifests sharing a base layer leave that layer on disk? The other retained manifest still needs it. Why is a digest in Git insufficient protection? Git names the object but does not control the registry's retention policy.
Tie retention to artifact identity. Use this graph to answer a cleanup that frees fewer bytes than expected.