A small tool used for purging a private Docker registry's old tags
1.3K
This is a small tool used for purging a private Docker registry's old tags. It fetches the list of tags for an image, keeps latest and the most recent NOF_TAGS_TO_KEEP tags and deletes all other tags.
To actually reclaim the space, you'd need to also run the registry's garbage collection.
This is a fork of blixhavn/docker-registry-retention which:
IMAGE_IGNORE_REGEX / DRY_RUN supportlatest when deleting container image tagsA Docker registry must be run with storage.deleted.enabled (e.g. REGISTRY_STORAGE_DELETE_ENABLED=true) to allow deletion.
Set the following environment variables and run the docker image, e.g as a cron job.
| Variable | Description | Default value |
|---|---|---|
| REGISTRY_URL | Base URL of the registry, with protocol (e.g. https://) | (undefined) |
| NOF_TAGS_TO_KEEP | Number of most recent tags to keep. latest is always kept. | 3 |
| IMAGE_IGNORE_REGEX | A regex for skipping processing of images (e.g. postgres|alpine) | (undefined) |
| DRY_RUN | If set, performs a dry-run and does not delete anything | (undefined) |
docker run -it --rm -e REGISTRY_URL=https://registry.example.com -e NOF_TAGS_TO_KEEP=3 devture/docker-registry-purger:latest
Run the registry's garbage collection now to actually reclaim the space.
Content type
Image
Digest
sha256:5031b4a43…
Size
20.2 MB
Last updated
over 3 years ago
docker pull devture/docker-registry-purger