{"id":25060268,"url":"https://github.com/42ways/vacuum-docker-registry","last_synced_at":"2025-10-11T15:02:57.037Z","repository":{"id":55993322,"uuid":"74773965","full_name":"42ways/vacuum-docker-registry","owner":"42ways","description":"A simple vacuum script for docker registries","archived":false,"fork":false,"pushed_at":"2020-12-02T12:46:43.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-30T09:58:51.299Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/42ways.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-25T16:36:59.000Z","updated_at":"2022-03-07T23:29:03.000Z","dependencies_parsed_at":"2022-08-15T11:00:43.462Z","dependency_job_id":null,"html_url":"https://github.com/42ways/vacuum-docker-registry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/42ways/vacuum-docker-registry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/42ways%2Fvacuum-docker-registry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/42ways%2Fvacuum-docker-registry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/42ways%2Fvacuum-docker-registry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/42ways%2Fvacuum-docker-registry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/42ways","download_url":"https://codeload.github.com/42ways/vacuum-docker-registry/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/42ways%2Fvacuum-docker-registry/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269183699,"owners_count":24374362,"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-08-06T02:00:09.910Z","response_time":99,"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-02-06T15:57:41.176Z","updated_at":"2025-10-11T15:02:52.015Z","avatar_url":"https://github.com/42ways.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vacuum-docker-registry - A simple vacuum script for docker registries\n\nThis is a simple vacuum script that cleans old images (:= 'manifests' in\ndocker-registry lingo) from a docker-registry. It it stateless except for its\nconfiguration and only uses the tags from the registry.\n\nA typical use case is to keep the latest n builds from a CI system like jenkins,\nbut also any that are currently used in production.\n\n**Note**: The docker registry currently (as of version 2.4) does not provide a\nREST API to actually free (\"garbage collect\") the disk space. This tool just\ncleans up the metadata.\n\nIn order to free the disk space, you have to run the\n*Docker Registry Garbage Collection* as described [here](https://docs.docker.com/registry/garbage-collection/).\n\nA typical wrapper script could look like this:\n```bash\n   rv=vacuum-registry.rb\n   if [[ $rv == 0 ]]; then\n      # images were deleted\n      # shutdown docker registry service\n      service docker-registry stop\n      docker-compose run registry garbage-collect /etc/docker/registry/config.yml\n      service docker-registry start\n   fi\n```\n\n## Cleanup Strategy:\n\n`vacuum-registry` inspects each repository (\"image\" ) listed in its configuration.\n\nFor each repository, it lists all the tags. If a tag is matched by one regular\nexpressions in the \"cleanup\" section of the config, it is elegible for cleanup.\n\nAll tags not matching an entry of the \"cleanup\" section are always kept. Of the\ncandidates we keep the n highest ones according to mixed alpha-numeric order\n(see below).\n\nWe then delete all manifests that are _only_ referenced by deleted tags (but\nnot by any of the kept tags).\n\n\n## Example configuration\n\n```\nregistry: http://localhost:5000\nkeep_count: 5\nrepositories:\n    my-docker-image:\n        cleanup:\n            - \"b-.*\"\n```\n\nThis would inspect the image `my-docker-image` on the docker repository `http://localhost:5000`.\n\nTags matching the regular expression `/b-.*/` are considered for cleanup. We always keep all images\npointed to by the last five build tags, as well as any images pointed to by *other* tags not\nlisted in the cleanup section.\n\nNote this enables us to keep any images that are currently in production by tagging those images;\ne.g., by `prod-#{servername}`.\n\n## Cleanup groups\n\nvacuum-docker registry optionally allows grouping images. The cleanup is applied to each group separately. This \nallows to keep, e.g., the last \"n\" builds for every branch.\n\nA grouping can be specified in the regular expression by using the named match group `(?\u003cgroup\u003e.*)`.\n\nFor instance, say images are tagged with `${branch_name}-b-${build_number}`. Then specifying the clean up\nregular expression:\n``` \n    - (?\u003cgroup\u003e.*)-b-.*\"    \n```\n... will result in each branch being looked at as a separate group; and the latest `$keep_count` builds from each groups being retained.\n\n\n## Tags sort order\n\nA configurable number of the \"cleanup\" tags is also kept. We keep the 'highest' tags\naccording to a mixed alpha-numeric sort. Mix alpha numeric order\nmeans that tags are split into numeric tokens and non-numeric tokens. Numeric tokens\nare sorted numerically, non-numeric tokens are sorted alphabetically.\n\nThis means that:\n - a-5 is before b-5\n - a-9 is before a-10\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F42ways%2Fvacuum-docker-registry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F42ways%2Fvacuum-docker-registry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F42ways%2Fvacuum-docker-registry/lists"}