Docker Certified Associate Exam Course

Docker Trusted Registry

Garbage Collection

Managing disk space in Docker Trusted Registry (DTR) is essential for stable registry performance. DTR stores images as layers, and when you delete an image tag via the UI, only the tag is removed—the underlying layers remain on disk. To reclaim storage, you must run garbage collection (GC), which identifies and deletes unreferenced layers.

Why Garbage Collection Matters

  • Layers are shared across multiple images and tags.
  • Deleting a tag does not free disk space immediately.
  • Premature removal of shared layers can break other images.

Note

Only image tags are removed when you delete an image in the UI. Layers stay on disk until garbage collection runs.

Configuring Garbage Collection

In the DTR UI, navigate to SystemGarbage Collection. Choose one of the following schedule options:

Schedule OptionDescription
IntervalRun GC at a recurring interval (e.g., daily).
Until donePerform a full scan and delete all unreferenced layers.
Fixed durationRun GC for a specified number of minutes.
NeverDisable GC; disk usage will continue to grow.

Warning

Garbage collection is CPU- and I/O-intensive. Schedule it during off-peak hours to minimize performance impact.

The image contains notes about garbage collection in a system, explaining that deleting images doesn't free up space and detailing the process and considerations for scheduling garbage collection.

Garbage Collection Workflow

  1. Read-only mode
    DTR blocks image pushes and modifications; pulls remain allowed.
  2. Marking
    DTR scans for unreferenced layers and marks them.
  3. Deletion
    DTR deletes the marked layers, reclaiming disk space.

Plan a maintenance window, as GC can temporarily impact registry operations.

Watch Video

Watch video content

Previous
Image Promotions