{"id":31943720,"url":"https://github.com/nstwfdev/docker-registry-image-cleaner","last_synced_at":"2025-10-14T10:00:14.924Z","repository":{"id":304400535,"uuid":"1018635000","full_name":"nstwfdev/docker-registry-image-cleaner","owner":"nstwfdev","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-21T06:03:14.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-21T08:24:10.362Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nstwfdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-12T17:32:03.000Z","updated_at":"2025-09-21T06:03:17.000Z","dependencies_parsed_at":"2025-07-12T22:07:26.624Z","dependency_job_id":"c142d57b-9d56-4f9f-b43b-a4261c9e206d","html_url":"https://github.com/nstwfdev/docker-registry-image-cleaner","commit_stats":null,"previous_names":["nstwfdev/docker-registry-image-cleaner"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nstwfdev/docker-registry-image-cleaner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstwfdev%2Fdocker-registry-image-cleaner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstwfdev%2Fdocker-registry-image-cleaner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstwfdev%2Fdocker-registry-image-cleaner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstwfdev%2Fdocker-registry-image-cleaner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nstwfdev","download_url":"https://codeload.github.com/nstwfdev/docker-registry-image-cleaner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstwfdev%2Fdocker-registry-image-cleaner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018563,"owners_count":26086405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-14T10:00:10.316Z","updated_at":"2025-10-14T10:00:14.915Z","avatar_url":"https://github.com/nstwfdev.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker \u0026 GHCR Image Cleaner\n\nA utility for automatically deleting old Docker images by prefix and age from Docker Hub and GitHub Container Registry (\nGHCR).\n\n---\n\n## Contents\n\n* [ Features ](#features)\n* [Quick Start](#quick-start)\n\n* [ 1. Using the `clean.sh` Script Locally ](#1-using-the-cleansh-script-locally)\n* [2. Running via Docker](#2-running-via-docker)\n* [GitHub Action: `nstwf/docker-registry-cleaner`](#github-action-nstwfdocker-registry-cleaner)\n\n* [ Usage in Workflow ](#usage-in-workflow)\n* [Action Inputs](#action-inputs)\n* [Help](#help)\n* [Support](#support)\n\n---\n\n## Features\n\n* Clean up Docker Hub and GHCR images from a single script\n* Filter by tag prefix (`IMAGE_PREFIX`)\n* Filter by image age in days (`MAX_AGE_DAYS`)\n* Easy to run locally or inside Docker\n* GitHub Action support\n\n---\n\n## Quick Start\n\n### 1. Using the `clean.sh` Script Locally\n\nYou need `bash`, `jq`, `curl`, and GNU `date` available.\n\n```bash\nDOCKERHUB_REPO=\"username/repo\" \\\nDOCKERHUB_USERNAME=\"user\" \\\nDOCKERHUB_PASSWORD=\"pass\" \\\nIMAGE_PREFIX=\"myapp-\" \\\nMAX_AGE_DAYS=7 \\\n./clean.sh\n```\n\n---\n\n### 2. Running via Docker\n\nPull the image from Docker Hub:\n\n  ```bash\n  docker pull nstwf/docker-registry-image-cleaner:latest\n  ```\n\nRun it with environment variables:\n\n  ```bash\n  docker run --rm \\\n  -e DOCKERHUB_REPO=\"username/repo\" \\\n  -e DOCKERHUB_USERNAME=\"user\" \\\n  -e DOCKERHUB_PASSWORD=\"pass\" \\\n  -e GHCR_REPO=\"ghcr.io/org/repo\" \\\n  -e GHCR_TOKEN=\"ghp_...\" \\\n  -e IMAGE_PREFIX=\"myapp-\" \\\n  -e MAX_AGE_DAYS=\"7\" \\\n  nstwf/docker-registry-image-cleaner:latest\n  ```\n\n---\n\n## GitHub Action: `nstwf/docker-registry-cleaner`\n\nRun the registry cleaner using the official Docker image inside your workflows without rebuilding the container.\n\n### Usage in Workflow\n\n```yaml\njobs:\n  cleanup:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Run Registry Cleaner\n        uses: nstwfdev/docker-registry-image-cleaner@v1\n        with:\n          dockerhub_repo: \"username/repo\"\n          dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}\n          dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}\n          ghcr_repo: \"ghcr.io/org/repo\"\n          ghcr_token: ${{ secrets.GHCR_TOKEN }}\n          image_prefix: \"myapp-\"\n          max_age_days: 7\n  ```\n\n### Action Inputs\n\n| Input                | Description                                                | Required |\n|----------------------|------------------------------------------------------------|----------|\n| `dockerhub_repo`     | Docker Hub repository (e.g. `username/repo`)               | no       |\n| `dockerhub_username` | Docker Hub username                                        | no\\*     |\n| `dockerhub_password` | Docker Hub password                                        | no\\*     |\n| `ghcr_repo`          | GitHub Container Registry repo (e.g. `ghcr.io/org/repo`)   | no       |\n| `ghcr_token`         | GitHub token with `delete:packages` permission             | no\\*     |\n| `image_prefix`       | (Optional) Only delete tags starting with this prefix      | no       |\n| `max_age_days`       | (Optional) Only delete tags older than this number of days | no       |\n\n*\\* Required if corresponding repository input is set.*\n\n---\n\n## Help\n\nYou can view the built-in help by running the container with `--help` or `-h`:\n\n  ```bash\n  docker run --rm nstwf/docker-registry-image-cleaner:latest --help\n  ```\n\nThis will display usage instructions and environment variable details from inside the container.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnstwfdev%2Fdocker-registry-image-cleaner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnstwfdev%2Fdocker-registry-image-cleaner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnstwfdev%2Fdocker-registry-image-cleaner/lists"}