Giter Club home page Giter Club logo

docker-repo-watcher's Introduction

docker-repo-watcher

Build Status

Docker local repository watcher

  • Can prune all docker instances
  • Can watch repository and delete stale images
  • Can update self docker container with new image
  • Can remove stale images from docker registry on the same host

Installation

  • docker pull freundallein/drwatcher:latest
  • docker run -d -v /var/run/docker.sock:/var/run/docker.sock freundallein/drwatcher:latest

Work

Starts docker prune crontb jobs with CRONTAB period.
Start custom image cleaning job,
for example your app image is 192.168.1.50:5000/custom-app and you want to store only 5 images from

192.168.1.50:5000/custom-app:2019-01-01.1
192.168.1.50:5000/custom-app:2019-01-01.2
192.168.1.50:5000/custom-app:2019-01-01.3
192.168.1.50:5000/custom-app:2019-01-01.4
192.168.1.50:5000/custom-app:2019-01-01.5
192.168.1.50:5000/custom-app:2019-01-01.6
192.168.1.50:5000/custom-app:2019-01-01.latest

So, drwatcher will check your local repository and remove stale images.
After one iteration with IMAGE_AMOUNT=5 your repository would look like this

192.168.1.50:5000/custom-app:2019-01-01.3
192.168.1.50:5000/custom-app:2019-01-01.4
192.168.1.50:5000/custom-app:2019-01-01.5
192.168.1.50:5000/custom-app:2019-01-01.6
192.168.1.50:5000/custom-app:2019-01-01.latest

Also, if you want to clean images form docker registry (on the same host),
you should pass -v /your/regitry/path:$REGISTRY_PATH and set CLEAN_REGISTRY=1.
Drwather will discover /_manifests/tags/ and /_manifests/revisions/,
decide what revisions and tags should be deleted, will delete it,
then will call registry garbage collect.

Options

  • REGISTRY_IP=192.168.1.50
  • REGISTRY_PORT=5000
  • APP_PREFIX="custom-app" (prefix of custom application)
  • CRONTAB="* * * * * *" (starts with seconds)
  • LOG_LEVEL=DEBUG (or ERROR)
  • PERIOD=60 (Period of custom image cleaning in seconds)
  • IMAGE_AMOUNT=5 (amount of custom images to stay)
  • AUTOUPDATE=1 (if you want autoupdate drwatcher)
  • CLEAN_REGISTRY=1 (if you want to clean your registry)
  • REGISTRY_PATH=/var/lib/registry

docker-repo-watcher's People

Contributors

freundallein avatar

Watchers

James Cloos 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.