Image Retention Policies, Garbage Collection & Vulnerability Gates
Set retention and vulnerability gates so registries stay clean and safe.
In plain words
Align registry deletion with rollback windows, release evidence and signature/SBOM retention.
Think of it like…
Retention is the archive destruction schedule: the label disappears first, but the box remains until every legal hold and cross-reference is released.
Where you’ve seen it
In practice, curl -X DELETE $REGISTRY/v2/acme/api/manifests/$DIGEST; registry garbage-collect --dry-run /etc/docker/registry/config.yml is the concrete move for this job: set retention and vulnerability gates so registries stay clean and safe. The release is not accepted until trace a deployed, signed and rollback-tagged digest through retention roots, then prove an expired unreferenced blob is removed confirms the result.
Words you’ll hear
- Retention
- The implementation control in
curl -X DELETE $REGISTRY/v2/acme/api/manifests/$DIGEST; registry garbage-collect --dry-run /etc/docker/registry/config.ymlfor set retention and vulnerability gates so registries stay clean and safe. - GC
- The result to observe with
trace a deployed, signed and rollback-tagged digest through retention roots, then prove an expired unreferenced blob is removed, rather than infer from a successful command alone. - Vuln Gates
- The production boundary exposed when deleting every tag older than 7 days when deployment rollback requires 30 days, or a scanner gate that approves a mutable tag instead of a digest.
Visual diagram
Theory & deep dive
Retention control path
The concrete mechanism is curl -X DELETE $REGISTRY/v2/acme/api/manifests/$DIGEST; registry garbage-collect --dry-run /etc/docker/registry/config.yml. The observable result is trace a deployed, signed and rollback-tagged digest through retention roots, then prove an expired unreferenced blob is removed; if those disagree, inspect the runtime evidence before changing unrelated settings.
Set retention and vulnerability gates so registries stay clean and safe. Keep Retention, GC and Vuln Gates in the same deployment record so the intent and the observed state cannot drift apart.
curl -X DELETE $REGISTRY/v2/acme/api/manifests/$DIGEST; registry garbage-collect --dry-run /etc/docker/registry/config.yml
trace a deployed, signed and rollback-tagged digest through retention roots, then prove an expired unreferenced blob is removed, not with command success alone.Vuln Gates failure boundary
Deleting a tag is not immediate blob deletion, and GC can break old signed references if retention ignores attestations. A gate on severity with no expiry/exception workflow either blocks releases forever or trains teams to bypass it. The narrow failure to design for is deleting every tag older than 7 days when deployment rollback requires 30 days, or a scanner gate that approves a mutable tag instead of a digest.
Accept this compromise explicitly: Aggressive retention reduces cost; longer provenance windows support incident response and rollback at storage expense. The controlled check-trace a deployed, signed and rollback-tagged digest through retention roots, then prove an expired unreferenced blob is removed-also identifies the point where a different design is safer.
Exercise this failure safely: deleting every tag older than 7 days when deployment rollback requires 30 days, or a scanner gate that approves a mutable tag instead of a digest.
How it works, step by step
Step 1 of 41. State the boundary
Write down why the workload needs this: Deleting a tag is not immediate blob deletion, and GC can break old signed references if retention ignores attestations. A gate on severity with no expiry/exception workflow either blocks releases forever or trains teams to bypass it.
- Intent
- Retention
When to use it & trade-offs
What it is
Retention decides which manifests and tags should survive, garbage collection reclaims blobs no longer reachable from retained roots, and vulnerability/provenance gates decide which exact digest may advance. Manifests referenced by a deployment or signature are roots even if human-facing tags are old.
Why it matters: Deleting a tag is not immediate blob deletion, and GC can break old signed references if retention ignores attestations. A gate on severity with no expiry/exception workflow either blocks releases forever or trains teams to bypass it.
When to reach for it
- The fit is strongest for this job: set retention and vulnerability gates so registries stay clean and safe. Pair it with
trace a deployed, signed and rollback-tagged digest through retention roots, then prove an expired unreferenced blob is removedin the runbook. - Production Retention changes should make GC observable through
curl -X DELETE $REGISTRY/v2/acme/api/manifests/$DIGEST; registry garbage-collect --dry-run /etc/docker/registry/config.yml, rather than trusting the runtime default. - Keep a rollback example for the case where deleting every tag older than 7 days when deployment rollback requires 30 days, or a scanner gate that approves a mutable tag instead of a digest.
When to avoid or be careful
- Do not accept command success while the system can still fail by deleting every tag older than 7 days when deployment rollback requires 30 days, or a scanner gate that approves a mutable tag instead of a digest.
- Avoid erasing Vuln Gates protection merely to dodge this cost: “Aggressive retention reduces cost; longer provenance windows support incident response and rollback at storage expense”.
- Do not replace the evidence path-
trace a deployed, signed and rollback-tagged digest through retention roots, then prove an expired unreferenced blob is removed-with a screenshot or a mutable tag.
curl -X DELETE $REGISTRY/v2/acme/api/manifests/$DIGEST; registry garbage-collect --dry-run /etc/docker/registry/config.yml: practical choices
Strengths: Retention decides which manifests and tags should survive, garbage collection reclaims blobs no longer reachable from retained roots, and vulnerability/provenance gates decide which exact digest may advance. Manifests referenced by a deployment or signature are roots even if human-facing tags are old.
Watch out: Aggressive retention reduces cost; longer provenance windows support incident response and rollback at storage expense.
Strengths: It can begin with curl -X DELETE $REGISTRY/v2/acme/api/manifests/$DIGEST; registry garbage-collect --dry-run /etc/docker/registry/config.yml and fewer surrounding controls.
Watch out: It silently accepts deleting every tag older than 7 days when deployment rollback requires 30 days, or a scanner gate that approves a mutable tag instead of a digest, which makes the result hard to reproduce after promotion.
Strengths: Deleting a tag is not immediate blob deletion, and GC can break old signed references if retention ignores attestations. A gate on severity with no expiry/exception workflow either blocks releases forever or trains teams to bypass it.
Watch out: The platform adds an ownership and debugging layer; retain trace a deployed, signed and rollback-tagged digest through retention roots, then prove an expired unreferenced blob is removed as the direct check.
Interview signals & numbers to know
When this topic comes up
- curl -X DELETE $REGISTRY/v2/acme/api/manifests/$DIGEST; registry garbage-collect --dry-run /etc/docker/registry/config.yml
- trace a deployed, signed and rollback-tagged digest through retention roots, then prove an expired unreferenced blob is removed
- Failure signature: deleting every tag older than 7 days when deployment rollback requires 30 days, or a scanner gate that approves a mutable tag instead of a digest
- Trade-off: Aggressive retention reduces cost; longer provenance windows support incident response and rollback at storage expense.
Benchmarks & rules of thumb
- 7/30 days
- example release-versus-rollback retention split
- 1 digest root
- signatures and deployments each need reachability analysis
- 0 blob space reclaimed
- when GC has not run after tag deletion
Common mistakes & follow-ups
Common interview mistakes
- Treating a successful
curl -X DELETE $REGISTRY/v2/acme/api/manifests/$DIGEST; registry garbage-collect --dry-run /etc/docker/registry/config.ymlas proof and skippingtrace a deployed, signed and rollback-tagged digest through retention roots, then prove an expired unreferenced blob is removed. - Deleting every tag older than 7 days when deployment rollback requires 30 days, or a scanner gate that approves a mutable tag instead of a digest
- Optimizing Retention without accepting that aggressive retention reduces cost; longer provenance windows support incident response and rollback at storage expense.
Likely interviewer follow-ups
- Why does
curl -X DELETE $REGISTRY/v2/acme/api/manifests/$DIGEST; registry garbage-collect --dry-run /etc/docker/registry/config.ymladdress Retention here rather than through application code? - How would you distinguish healthy GC from the failure “deleting every tag older than 7 days when deployment rollback requires 30 days, or a scanner gate that approves a mutable tag instead of a digest” using
trace a deployed, signed and rollback-tagged digest through retention roots, then prove an expired unreferenced blob is removed? - When would this trade-off-“Aggressive retention reduces cost; longer provenance windows support incident response and rollback at storage expense”-justify a different Vuln Gates design?
curl -X DELETE $REGISTRY/v2/acme/api/manifests/$DIGEST; registry garbage-collect --dry-run /etc/docker/registry/config.yml-and one proof-trace a deployed, signed and rollback-tagged digest through retention roots, then prove an expired unreferenced blob is removed. Then name the boundary: deleting every tag older than 7 days when deployment rollback requires 30 days, or a scanner gate that approves a mutable tag instead of a digest.Knowledge check
Put it into practice
Practice related interview Q&A
Apply Image Retention Policies, Garbage Collection & Vulnerability Gates with generative AI interview Q&A and hands-on practice.