Skip to content

🚀 Docker Hub Cleanup Action v1.0.0 - Production Ready Release

Choose a tag to compare

@nsouto nsouto released this 10 Aug 11:31
· 2 commits to main since this release
ea2cbf0

Release v1.0.0 - Docker Hub Cleanup Action

🎉 Initial Release

We're excited to announce the first release of the Docker Hub Cleanup GitHub Action! This action helps you automatically manage Docker Hub storage by cleaning up old and unused tags while protecting important ones.

✨ Features

Core Functionality

  • Automated Cleanup: Remove old PR tags and branch SHA tags based on configurable retention periods
  • Multiple Repository Support: Clean multiple Docker repositories in a single workflow run
  • Flexible Authentication: Works with both Docker Hub passwords and Personal Access Tokens (PATs)
  • Dry-Run Mode: Test your cleanup configuration safely before actual deletion

Safety Features

  • Protected Tags: Never deletes important tags:
    • latest, main, master, develop
    • Semantic version tags (e.g., v1.0.0, 1.0.0, 1.0, 1)
    • Custom protected tags via configuration
  • Detailed Logging: Comprehensive output showing what will be or was deleted
  • Error Handling: Robust retry logic with exponential backoff for API failures

Configuration Options

  • Custom Retention Periods: Set different retention days for PR tags and SHA tags
  • Custom Tag Patterns: Define your own patterns with specific retention periods
  • Organization Support: Works with both personal and organization Docker Hub accounts
  • Verbose Mode: Enable detailed debugging output when needed

Action Outputs

  • deleted-count: Total number of tags actually deleted
  • identified-count: Number of tags identified for deletion
  • protected-count: Number of tags protected from deletion
  • summary: JSON summary of the entire cleanup operation

📋 Default Cleanup Rules

Tag Pattern Example Default Retention
PR tags pr-123, pr-456 30 days
Branch SHA tags main-abc123f, develop-xyz789a 14 days

🚀 Quick Start

- name: Docker Hub Cleanup
  uses: lostlink/docker-cleanup@v1
  with:
    username: ${{ secrets.DOCKERHUB_USERNAME }}
    password: ${{ secrets.DOCKERHUB_PASSWORD }}
    repositories: 'image1,image2,image3'
    dry-run: false

📖 Documentation

🔧 Technical Details

  • Language: Python 3.11+
  • Authentication: Docker Registry v2 API with fallback to Docker Hub API
  • Compatibility: Works with GitHub-hosted and self-hosted runners
  • License: MIT

🙏 Acknowledgments

This action was created to solve the common problem of Docker Hub storage management in CI/CD pipelines. Special thanks to the Docker and GitHub Actions communities for their inspiration and feedback.

📝 Notes

  • Always test with dry-run: true before enabling actual deletion
  • Start with conservative retention periods and adjust based on your needs
  • Consider running the cleanup weekly during off-peak hours

🐛 Reporting Issues

If you encounter any problems, please file an issue with:

  • Your workflow configuration (with secrets redacted)
  • The error message or unexpected behavior
  • The Docker Hub repository structure you're trying to clean

Full Changelog: This is the initial release