Sign inSign up

devture/docker-registry-purger

By devture

Updated over 3 years ago

A small tool used for purging a private Docker registry's old tags

Image
0

1.3K

devture/docker-registry-purger repository overview

Docker Registry Purger

Docker Pulls

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.

History

This is a fork of blixhavn/docker-registry-retention which:

  • adds IMAGE_IGNORE_REGEX / DRY_RUN support
  • removes basic authentication support
  • always keeps latest when deleting container image tags

Prerequisites

A Docker registry must be run with storage.deleted.enabled (e.g. REGISTRY_STORAGE_DELETE_ENABLED=true) to allow deletion.

Environment variables

Set the following environment variables and run the docker image, e.g as a cron job.

VariableDescriptionDefault value
REGISTRY_URLBase URL of the registry, with protocol (e.g. https://)(undefined)
NOF_TAGS_TO_KEEPNumber of most recent tags to keep. latest is always kept.3
IMAGE_IGNORE_REGEXA regex for skipping processing of images (e.g. postgres|alpine)(undefined)
DRY_RUNIf set, performs a dry-run and does not delete anything(undefined)

Usage

  1. docker run -it --rm -e REGISTRY_URL=https://registry.example.com -e NOF_TAGS_TO_KEEP=3 devture/docker-registry-purger:latest

  2. Run the registry's garbage collection now to actually reclaim the space.

Tag summary

Content type

Image

Digest

sha256:5031b4a43

Size

20.2 MB

Last updated

over 3 years ago

docker pull devture/docker-registry-purger