This tool allows cleanup target docker registry. You can define rules of how much tags should be retained in each tag group
The tool only remove tags - not blobs in docker registry. To free up space on disk, run:
docker exec <registry container> bin/registry garbage-collect /etc/docker/registry/config.yml
docker run \
-v `pwd`/rules.yml:/etc/cleaner/rules.yml \
-e REGISTRY_HOST=<host> \
-e REGISTRY_USER=<user> \
-e REGISTRY_PASSWORD=<password> \
ghcr.io/junte/docker-registry-cleaner:0.1.8
Parameter | Description |
---|---|
REGISTRY_HOST | docker registry address |
REGISTRY_USER | (optional) docker registry user |
REGISTRY_PASSWORD | (optional) docker registry password |
DRY_RUN | (optional) dry run mode. Only show tags which will be deleted |
repositories:
- name: <repository path>
tags:
- pattern: <tag filter regex>
retain: <count of last tags which must be ratained>
...
...
This config will keep:
- keep 5 last from
rc
tags, 3 last fromdev
tags inbackend
repository. Others will be deleted. - keep 2 last in
features
path fromfrontend
repository. Tags from another parts will not be deleted. - other repositories will not be processed
repositories:
- name: backend
tags:
- pattern: "rc-.*"
retain: 5
- pattern: "dev-.*"
retain: 3
- pattern: ".*"
retain: 0
- name: frontend
tags:
- pattern: "features.*"
retain: 2