{"id":15171802,"url":"https://github.com/htekgulds/gitlab-registry-cleaner-cli","last_synced_at":"2026-02-11T10:31:50.487Z","repository":{"id":208630133,"uuid":"721964076","full_name":"htekgulds/gitlab-registry-cleaner-cli","owner":"htekgulds","description":"Gitlab Registry Cleaner CLI","archived":false,"fork":false,"pushed_at":"2023-12-01T09:35:31.000Z","size":369,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T06:22:46.385Z","etag":null,"topics":["cleaner","cli","docker","esbuild","gitlab","grc","nodejs","pkg","registry","yargs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/htekgulds.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}},"created_at":"2023-11-22T06:32:41.000Z","updated_at":"2023-11-28T18:54:32.000Z","dependencies_parsed_at":"2024-09-27T09:04:08.683Z","dependency_job_id":"a4338592-ec81-431e-84b8-bf7462458c50","html_url":"https://github.com/htekgulds/gitlab-registry-cleaner-cli","commit_stats":null,"previous_names":["htekgulds/gitlab-registry-cleaner-cli"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/htekgulds/gitlab-registry-cleaner-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htekgulds%2Fgitlab-registry-cleaner-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htekgulds%2Fgitlab-registry-cleaner-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htekgulds%2Fgitlab-registry-cleaner-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htekgulds%2Fgitlab-registry-cleaner-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/htekgulds","download_url":"https://codeload.github.com/htekgulds/gitlab-registry-cleaner-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htekgulds%2Fgitlab-registry-cleaner-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29332277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T06:13:03.264Z","status":"ssl_error","status_checked_at":"2026-02-11T06:12:55.843Z","response_time":97,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cleaner","cli","docker","esbuild","gitlab","grc","nodejs","pkg","registry","yargs"],"created_at":"2024-09-27T09:04:05.250Z","updated_at":"2026-02-11T10:31:50.465Z","avatar_url":"https://github.com/htekgulds.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gitlab Registry Cleaner CLI (grc)\n\n[![npm](https://img.shields.io/npm/v/gitlab-registry-cleaner-cli?logo=npm)](https://www.npmjs.com/package/gitlab-registry-cleaner-cli) [![NPM](https://img.shields.io/npm/l/gitlab-registry-cleaner-cli)](https://github.com/htekgulds/gitlab-registry-cleaner-cli/blob/main/LICENCE.md) ![npm](https://img.shields.io/npm/dm/gitlab-registry-cleaner-cli)\n\n**Hello there! :wave:**\n\nThis is my first real (_kinda_) open source project. It is a container registry cleaner cli tool for Gitlab. You can get statistics about your image tags, or bulk-delete some of them based on suffixes. This tool is useful when you want to cleanup unused and old images within your self-hosted Gitlab instance in bulks. There are other projects like this one (mentioned below) but as far as i can see, all of them are focused on single project cleaning, which you need to setup per project and that is a lot of work! I needed a bulk-cleaner that i can run and clean all of the images in my Gitlab instance and this project was born.\n\n## Installation\n\nYou can download the tool via npm or yarn using the following commands:\n\n```sh\n# with npm\nnpm install --global gitlab-registry-cleaner-cli\n\n# with yarn\nyarn global add gitlab-registry-cleaner-cli\n```\n\nOr, you can get fetch the binary suitable for your OS from the [Releases](https://github.com/htekgulds/gitlab-registry-cleaner-cli/releases) page. You can use the following script to install it quickly:\n\n```sh\n# Download latest version\nwget https://github.com/htekgulds/gitlab-registry-cleaner-cli/releases/latest/download/grc-linux -O grc\n# Install under /usr/local/bin\nsudo install -o root -g root -m 755 grc /usr/local/bin/grc\n# Remove residue\nrm -f grc\n```\n\n## Usage\n\nYou can use the tool with the `grc` command (`grc --help` for all the available commands and options).\n\n### Commands\n\n- `stats`: Get image statistics. Uses `group-tags-regex` option for calculating a group-by-summary\n- `cleanup`: Cleanup images according to options\n- `check`: Check options and Gitlab connection (debug command)\n\n### Options\n\nYou can provide options to the commands in various ways.\n\n- As command line arguments (eg. `--gitlab-base-url`)\n- As env variables (eg. `GITLAB_BASE_URL`)\n- From a JSON file either using the default config paths or providing a path with `--config-path` option. Default config file paths are `.grc.json` and `$home/.grc.json` so these files are picked up by default.\n\nHere is a list of options with their env variable forms and default values:\n\n- **`gitlab-base-url` or `url`:** Base URL of the Gitlab instance. Env variable: `GRC_GITLAB_BASE_URL`. No default value. This option is required for the tool to function.\n- **`gitlab-token` or `token`:** Gitlab access token authorized for deleting images. Env variable: `GRC_GITLAB_TOKEN`. No default value. This option is required for the tool to function.\n- **`keen-n`:** Do not delete `n` number of latest image tags. Env variable: `GRC_KEEP_N`. Default value is `5`.\n- **`older-than`:** Delete image tags older than given time (eg. 5d, 1h). Env variable: `GRC_OLDER_THAN`. Default value is `7d`.\n- **`group-tags-regex`:** Group image tags by given regex when showing image stats or a list of groups to delete. Env variable: `GRC_GROUP_TAGS_REGEX`. Default value is `/^[a-zA-Z0-9.]+(-[0-9]+)?-(.\\*)$/`.\n- **`delete-tags-regex`:** Delete image tags with the given regex. No list will be prompted if this option is provided and `--group-tags-regex` option will be ignored. Env variable: `GRC_DELETE_TAGS_SUFFIX`. No default value.\n- **`config-path`:** Config file path for getting the option values from. Env variable: `GRC_CONFIG_PATH`. Default value is `$HOME/.grc`.\n- **`dry-run`:** Do not actually delete the image tags. Env variable: `GRC_DRY_RUN`. Default value is `false`.\n- **`verbose` or `v`:** More detailed logs (3 levels: `-v`, `-vv`, `-vvv`).\n- **`yes`:** Do not ask for confirmation before deleting images. This can be used for non-interactive operations (ci/cd or cronjobs).\n\nExample config file content:\n\n```json\n{\n  \"gitlabBaseUrl\": \"https://git.mycompany.com\", // or url (required)\n  \"gitlabToken\": \"abcdef\", // or token (required)\n  \"keepN\": 3,\n  \"olderThan\": \"3d\",\n  \"groupTagsRegex\": \"/[a-zA-Z0-9.]+-(.*)/\",\n  \"deleteTagsRegex\": \".*-dev\",\n  \"dryRun\": true\n}\n```\n\nOptions are taken in the following order:\n\n1. Command line arguments\n2. Env variables\n3. Config file\n4. Default values\n\n## Credits\n\nCredits are due for the following awesome libraries:\n\n- [yargs](https://yargs.js.org/) - for easy cli creation (commands, options, help, etc.)\n- [@clack/prompts](https://www.npmjs.com/package/@clack/prompts) - for beautiful, step-by-step style cli prompts\n- also [chalk](https://www.npmjs.com/package/chalk) and [boxen](https://www.npmjs.com/package/boxen) - for further styling\n\nAlso there are other alternatives as far as I can see like the ones below. But I haven't seen any that can delete images in bulk so I created yet another one :sweat_smile:\n\n- https://github.com/10up/Gitlab-Registry-Cleaner\n- https://github.com/sciapp/gitlab-registry-cleanup\n- https://github.com/n0madic/gitlab-registry-images-cleaner\n- https://github.com/ivanetchart/gitlab-registry-cleaner\n\n## Contributing\n\nThis is like a hobby project for me but I'm open to suggestions and contributions for making it more useful.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhtekgulds%2Fgitlab-registry-cleaner-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhtekgulds%2Fgitlab-registry-cleaner-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhtekgulds%2Fgitlab-registry-cleaner-cli/lists"}