Sunday, 9 November 2025

Mastering Docker Image Pruning with Robin Platform: Clean Up Your Cluster Efficiently

Unused Docker images can silently consume significant disk space across your cluster. Over time, this can lead to bloated storage and degraded performance. Robin simplifies the process of identifying and removing these unused images across hosts in your cluster. This blog post walks you through how to prune unused images manually and how to automate the process using scheduled jobs.


๐Ÿ”ง Command: robin host pruneimage

This command allows you to prune unused Docker images from one or more hosts in your Robin cluster. These are images not currently used by any running containers.

๐Ÿ“Œ Syntax

robin host pruneimage [<hostnames>]
                      --skip-images-file <skipimagespath>
                      --all

๐Ÿ”น Parameters

  • hostnames: Comma-separated list of host FQDNs (e.g., vnode36.robinsystems.com)
  • --skip-images-file <path>: Path to a file listing images to exclude from pruning. Format: <image>:<tag> per line.
  • --all: Prune unused images from all hosts in the cluster.

๐Ÿงน 4.12.1 Pruning Images

To remove unused images from a specific host, use:

# robin host pruneimage vnode36.robinsystems.com --wait

✅ Output

Job:  226 Name: HostPruneImagesMulti           State: PROCESSED       Error: 0
Job:  226 Name: HostPruneImagesMulti           State: COMPLETED       Error: 0

This output confirms that the pruning job was successfully processed and completed without errors.


⏰ 4.12.2 Enabling Pruning Schedule

Robin allows you to automate image pruning using a CRON schedule. This mimics garbage collection and keeps your system clean without manual intervention.

๐Ÿ”น Step 1: Enable the schedule

# robin config update server enableimageprune_schedule true

Output:

The 'server' attribute 'enable_image_prune_schedule' has been updated

๐Ÿ”น Step 2: Set the CRON schedule

This CRON string schedules the pruning job to run daily at 2:00 AM.

# robin config update server image_prune_cron "0 2 * * *"
The 'server' attribute 'image_prune_cron' has been updated

Output:

The 'server' attribute 'image_prune_cron' has been updated

๐Ÿšซ 4.12.3 Disabling Pruning Schedule

To stop the automatic pruning job, simply disable the schedule:

# robin config update server enableimageprune_schedule false

Output:

The 'server' attribute 'enable_image_prune_schedule' has been updated

๐Ÿ“ Summary

TaskCommandDescription
Manual prunerobin host pruneimage <host>Removes unused images from specified host
Skip specific images--skip-images-file <path>Prevents listed images from being pruned
Prune all hosts--allTargets all hosts in the cluster
Enable schedulerobin config update server enable_image_prune_schedule trueTurns on scheduled pruning
Set schedulerobin config update server image_prune_cron "<cron>"Defines when pruning should occur
Disable schedulerobin config update server enable_image_prune_schedule falseTurns off scheduled pruning

๐Ÿ’ก Pro Tip

Use the --skip-images-file option to protect critical images from being accidentally removed. This is especially useful in production environments where certain base images are reused frequently.

No comments:

Post a Comment