Automated Docker Registry Cleanup and Notification Workflow

somdn_product_page

This n8n workflow is designed to automate the cleanup of old Docker image tags from a Docker registry, ensuring efficient storage management and maintaining the latest image versions. It runs on a scheduled basis, performs a series of steps to identify outdated tags, deletes them, and sends notifications about the actions taken.

Here’s a detailed breakdown:

1. **Scheduled Trigger** initiates the process at a set interval (e.g., daily or weekly).

2. The workflow fetches the list of all Docker images in the registry using the ‘List Images’ node.

3. For each image, it retrieves associated tags with the ‘Retrieve Image Tags’ node.

4. The ‘Split Tags’ node separates each tag for individual processing.

5. It filters only valid tags (non-empty) via the ‘Filter Valid Tags’ node.

6. For each valid tag, it fetches the manifest digest using the ‘Fetch Manifest Digest for Blob’ node.

7. The ‘Identify Tags to Remove’ node analyzes tags, keeping the latest 10, the ‘latest’ tag (if present), and marks older tags for removal.

8. For each outdated tag identified, the workflow deletes the tag by sending an HTTP DELETE request in the ‘Remove Old Tags’ node.

9. After deletion, it fetches digest details for reporting purposes.

10. The ‘Group Tags by Image’ and ‘Sort by Creation Date’ nodes organize data to understand tag history.

11. Notifications about the deletion, including details of the image and tag removed, are sent via email. If deletion fails, a failure notification is sent.

This automation helps maintain a clean Docker registry by removing outdated images, automates storage management, and keeps the team informed through email notifications. It’s particularly useful for CI/CD pipelines or environments where frequent image updates occur, ensuring optimal registry performance and cost-efficiency.

Node Count

11 – 20 Nodes

Nodes Used

code, emailSend, filter, httpRequest, scheduleTrigger, set, sort, splitOut, ssh

Reviews

There are no reviews yet.

Be the first to review “Automated Docker Registry Cleanup and Notification Workflow”

Your email address will not be published. Required fields are marked *