Giter Club home page Giter Club logo

docker-registry-purger's Introduction

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.

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)

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.

docker-registry-purger's People

Contributors

blixhavn avatar spantaleev avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.