{"id":18781568,"url":"https://github.com/devture/docker-registry-purger","last_synced_at":"2025-04-10T23:51:38.412Z","repository":{"id":75996740,"uuid":"587227967","full_name":"devture/docker-registry-purger","owner":"devture","description":"A small tool used for purging a private Docker registry's old tags","archived":false,"fork":false,"pushed_at":"2023-01-10T10:21:11.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T20:42:17.174Z","etag":null,"topics":["docker","docker-registry","docker-registry-cleanup"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devture.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2023-01-10T09:02:47.000Z","updated_at":"2024-11-11T21:14:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"163b315f-94ca-451a-b50f-ce202efdfa8a","html_url":"https://github.com/devture/docker-registry-purger","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devture%2Fdocker-registry-purger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devture%2Fdocker-registry-purger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devture%2Fdocker-registry-purger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devture%2Fdocker-registry-purger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devture","download_url":"https://codeload.github.com/devture/docker-registry-purger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317706,"owners_count":21083528,"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","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":["docker","docker-registry","docker-registry-cleanup"],"created_at":"2024-11-07T20:32:38.209Z","updated_at":"2025-04-10T23:51:38.389Z","avatar_url":"https://github.com/devture.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Registry Purger\n\n[![Docker Pulls](https://img.shields.io/docker/pulls/devture/docker-registry-purger.svg)](https://hub.docker.com/r/devture/docker-registry-purger/)\n\nThis is a small tool used for purging a private Docker registry's old tags. It fetches the list of tags for an image, keeps `latest` and the most recent `NOF_TAGS_TO_KEEP` tags and deletes all other tags.\n\nTo actually reclaim the space, you'd need to also run the registry's [garbage collection](https://docs.docker.com/registry/garbage-collection/#run-garbage-collection).\n\n\n## History\n\nThis is a fork of [blixhavn/docker-registry-retention](https://github.com/blixhavn/docker-registry-retention) which:\n\n- adds `IMAGE_IGNORE_REGEX` / `DRY_RUN` support\n- removes basic authentication support\n- always keeps `latest` when deleting container image tags\n\n\n## Prerequisites\n\nA Docker registry must be run with [`storage.deleted.enabled`](https://docs.docker.com/registry/configuration/#delete) (e.g. `REGISTRY_STORAGE_DELETE_ENABLED=true`) to allow deletion.\n\n\n## Environment variables\n\nSet the following environment variables and run the docker image, e.g as a cron job.\n\n|**Variable**         | **Description**                                                    | **Default value**|\n|:--------------------|:-------------------------------------------------------------------|:-----------------|\n|REGISTRY_URL         |Base URL of the registry, with protocol (e.g. https://)             | (undefined)      |\n|NOF_TAGS_TO_KEEP     |Number of most recent tags to keep. `latest` is always kept.        | 3                |\n|IMAGE_IGNORE_REGEX   |A regex for skipping processing of images (e.g. `postgres\\|alpine`) | (undefined)      |\n|DRY_RUN              |If set, performs a dry-run and does not delete anything             | (undefined)      |\n\n\n## Usage\n\n1. `docker run -it --rm -e REGISTRY_URL=https://registry.example.com -e NOF_TAGS_TO_KEEP=3 devture/docker-registry-purger:latest`\n\n2. Run the registry's [garbage collection](https://docs.docker.com/registry/garbage-collection/#run-garbage-collection) now to actually reclaim the space.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevture%2Fdocker-registry-purger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevture%2Fdocker-registry-purger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevture%2Fdocker-registry-purger/lists"}