Docker Certified Associate Exam Course

Docker Trusted Registry

Demo Image promotion and Garbage Collection

Optimize your Docker image workflow by configuring automatic image promotions from development to production repositories and managing storage with garbage collection in Docker Trusted Registry (DTR).

Table of Contents

  1. Configure Image Promotion Policy
  2. Push and Promote an Image
  3. Configure Garbage Collection
  4. Links and References

Configure Image Promotion Policy

First, set up an automated policy to move images tagged as stable from your development repository (devimages) to production (prodimages).

  1. In the DTR UI, go to Repositories and select devimages.
  2. Click Promotions and choose Tag Name as the criterion.
  3. Define the rule:
    • tagName == "stable"
  4. Click Add.
  5. Under Target Repository, pick prodimages.
  6. For Target Tag Name, enter %n to preserve the original tag.
  7. Save by clicking Save and Apply.

The image shows a Docker Enterprise Trusted Registry interface, specifically the repositories section, with options to filter by tag name and other criteria. It also includes fields for specifying a target repository and tag name variables.

After saving, you’ll see the new policy listed with Last Promoted set to never until it runs for the first time.

The image shows a Docker Enterprise Trusted Registry interface where a user is configuring repository settings, including criteria for vulnerabilities and tag naming conventions.

Note

Make sure both devimages and prodimages repositories exist and are empty before you create the policy.


Push and Promote an Image

Tag and push an image with stable on your local machine to trigger the promotion:

# Tag alpine:latest for devimages
docker tag alpine:latest 54.145.234.153/yogeshraheja/devimages:stable

# Push to the devimages repository
docker push 54.145.234.153/yogeshraheja/devimages:stable

Return to the DTR console:

  1. Refresh devimages.
  2. Under Promotions, Last Promoted will update to the current timestamp.
  3. Click Activity to view the detailed promotion log.

To confirm, inspect prodimages:

The image shows a Docker Enterprise Trusted Registry interface displaying details of a repository named "yogeshraheja/prodimages," including a tagged image labeled "stable(Promoted)" with its type, ID, size, and vulnerability scan options.

The stable (Promoted) tag indicates that the image has been moved successfully.

Warning

Production repositories should only receive thoroughly tested images. Double-check your promotion rules to avoid deploying unverified containers.


Configure Garbage Collection

Over time, untagged images accumulate and consume disk space. DTR’s Garbage Collection removes these images based on your schedule.

  1. Navigate to System > Garbage Collection in the DTR UI.
  2. Choose a collection mode:
ModeDescription
Until DoneRuns until all untagged images are removed.
For a Defined TimeRuns for a specified duration (e.g., 10 minutes).
Never (Default)Disables automatic garbage collection.
  1. (Optional) Schedule it using a cron expression for regular cleanups.
  2. Click Save to apply.

The image shows a Docker Enterprise Trusted Registry interface focused on garbage collection settings, allowing users to configure the removal of untagged images. Options include setting a duration for the process and scheduling it with a cron job.

Note

By default, automatic garbage collection is disabled. Enabling it prevents your DTR storage from filling up.



Watch Video

Watch video content

Previous
Garbage Collection