At [Yodle](http://www.yodle.com/), we started using Docker with a privately hosted [Docker Registry](https://github.com/docker/docker-registry). This was great until we discovered that the registry had no tools to cleanup old, unused images! Our disks began to fill up, so this was created to fill the gap.
This cleaner is designed to work with the v1 Registry provided by Docker. It has not been tested against the [Registry v2](https://github.com/docker/distribution), which may have different assumptions. We will gladly accept pull requests to add support for this (see Contributing below).
This tool is best used as a scheduled task, to periodicly remove cruft from your registry on disk. It is also advisible to untag old images as well. Tagged images are always referenced, so there may be cruft that this cleaner will not notice. Untagging as a feature will be included in this project as a plugin.
# Installing
To use this cleaner, clone the repository and run `python cleaner` from the project root
Coming soon: `pip install docker-registry-cleaner`
# Warning
This was developed against our docker repository. If your registry is different, it may cause problems. Please back up your registry and use scrub rather than purge until you are confident it works for your setup. In particular, this tool assumes you are storing your images directly on disk. It has not been designed to work with other storage drivers yet.
# Usage
In order to authenticate against your registry, you need to set the following environment variables:
`registry_username` and `registry_password`
usage: cleaner [-h] [--hostname [HOSTNAME [HOSTNAME ...]]] [--path PATH]
repository command
positional arguments:
repository the repository path
command untag, validate, report, scrub, revert
optional arguments:
-h, --help show this help message and exit
--hostname [HOSTNAME [HOSTNAME ...]]
the registry hostname. Required for untag
--path PATH path to tmp directory to restore
You may want to untag old images before purging
./dr_clean untag $REPOSITORY_HOME
./dr_clean purge $REPOSITORY_HOME
If you are using safe deletes, then you can also restore with
./dr_clean restore $REPOSITORY_HOME
This might be wise if you have frequent enough pushes. There is a race condition where an image may be pushed, but the reference is not written to disk yet, and it will be picked up for deletion. This won't happen if your $KEEP window is long enough though.
# Contributing
Pull requests are welcome! All tests must pass and be pep8 compliant.
Tests are run by executing ```nosetests``` in the root of the project.
Style is checked by running ```pylint``` in the root of the project.
# License
Apache 2 Licensed.
Metadata
Release files for docker-registry-cleaner 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| docker-registry-cleaner-0.1.0.tar.gz | 6.1 kB | Without provenance | Details for docker-registry-cleaner-0.1.0.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| docker_registry_cleaner-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for docker_registry_cleaner-0.1.0-py3-none-any.whl |
| docker_registry_cleaner-0.1.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for docker_registry_cleaner-0.1.0-py2.py3-none-any.whl |
Total release size: 25.8 kB
Release files / docker-registry-cleaner-0.1.0.tar.gz
| Download URL | docker-registry-cleaner-0.1.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ee02b8915f1f8a3b28776bfc8625aa84c9ede4a2c63d982d992c4f609b3a0bf
|
|
BLAKE2b-256 checksum How to use checksums |
54a87277667d26f5f743dae65eb9f1f604b6e8cf04271a05286fed07cdb7ba65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / docker_registry_cleaner-0.1.0-py3-none-any.whl
| Download URL | docker_registry_cleaner-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8aa34bb0c92791c28f474572a737adb8a06cbc9e57627adf46517bfa441ffeeb
|
|
BLAKE2b-256 checksum How to use checksums |
44414069ccc0d25559848c1ba8b5c74dc480e7422196e12b66a8522283f84624
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / docker_registry_cleaner-0.1.0-py2.py3-none-any.whl
| Download URL | docker_registry_cleaner-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
8cf605f33847f5bd1cb8fde5fc3416bc5b35dbce03b5c5d035994d872cb16f64
|
|
BLAKE2b-256 checksum How to use checksums |
be5bff32d9b8b156cc15cd73fd773b1d0c220ec21f87aa64a3c73f53293ad44d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for docker-registry-cleaner 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.