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
- Configure Image Promotion Policy
- Push and Promote an Image
- Configure Garbage Collection
- 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
).
- In the DTR UI, go to Repositories and select devimages.
- Click Promotions and choose Tag Name as the criterion.
- Define the rule:
- tagName ==
"stable"
- tagName ==
- Click Add.
- Under Target Repository, pick prodimages.
- For Target Tag Name, enter
%n
to preserve the original tag. - Save by clicking Save and Apply.
After saving, you’ll see the new policy listed with Last Promoted set to never until it runs for the first time.
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:
- Refresh devimages.
- Under Promotions, Last Promoted will update to the current timestamp.
- Click Activity to view the detailed promotion log.
To confirm, inspect prodimages:
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.
- Navigate to System > Garbage Collection in the DTR UI.
- Choose a collection mode:
Mode | Description |
---|---|
Until Done | Runs until all untagged images are removed. |
For a Defined Time | Runs for a specified duration (e.g., 10 minutes). |
Never (Default) | Disables automatic garbage collection. |
- (Optional) Schedule it using a cron expression for regular cleanups.
- Click Save to apply.
Note
By default, automatic garbage collection is disabled. Enabling it prevents your DTR storage from filling up.
Links and References
Watch Video
Watch video content