Smart Docker Registry cleaner.
GitHub: https://github.com/glorpen/docker-registry-cleaner
BitBucket: https://bitbucket.org/glorpen/docker-registry-cleaner
Docker Hub: https://hub.docker.com/r/glorpen/registry-cleaner
Container version uses bundled Docker Registry binary, see _[Bundled registry versions]{.title-ref} table below.
cleaner registry
1.0.0 2.7.1
Workarounds for versions 2.6+ of Docker Registry.
See https://github.com/docker/distribution/issues/1811
Docker Registry has no native support for deleting single tag from an image.
Fortunatelly it is possible to workaround this problem so Docker Registry Cleaner will safely remove tag from image, without removing image itself. The process is quite simple:
There is no way to remove repository using REST API, even one without tags - empty repo is still listed by registry.
Currently files should be cleaned on GC run on registry side (or some third party app, like this one).
Removes build tags created by CI:
patterns:
latest:
- "latest"
ci:
"r-([0-9]+)": "\\1"
"build-([0-9]+)": "\\1"
repositories:
some-name:
paths:
- "library/*"
cleaners:
latest:
type: pattern
pattern: ci
max_items: 10
Removes tags that are not known for groups before it.
repositories:
some-name:
paths:
- "library/*":
cleaners:
# ... other groups ...
other:
type: max
max_items: 0
As in http://semver.org/
versioned:
type: semver
max_items: 100
groups:
current_minor:
where:
major: latest
minor: latest
preserve:
patch: 6
current_major:
where:
major: latest
minor:
min: 0
max: latest - 1
preserve:
patch: 1
archival:
where:
major:
max: latest - 1
preserve:
minor: 1
patch: 1
max_items: 20
Above config will:
For more info see https://docker-registry-cleaner.readthedocs.io/en/latest/code/selectors.html#glorpen-docker-registry-cleaner-selectors-semver
App requires two paths:
It is advised to temporarly disable real registry (as when using normal
registry garbage-collect).
For example, to list repos:
docker run --rm -v `pwd`:/srv glorpen/registry-cleaner /srv/config.yml -d /srv/registry-data list-repos
and then to clean:
docker run --rm -v `pwd`:/srv glorpen/registry-cleaner /srv/config.yml -d /srv/registry-data clean
Content type
Image
Digest
Size
35 MB
Last updated
over 7 years ago
docker pull glorpen/registry-cleaner