Giter VIP home page Giter VIP logo

infra-docker-proper's Introduction

Docker Proper

OS. Proper swabbing the deck

This tool will delete all containers that are:

  • not running
  • exit time is older than -ca hours ago
  • not used as volume containers by containers created after -ca hours ago

And will attempt(!) to delete all images that are:

  • creation time is older than -ia hours ago
  • not used by any container created after -ca hours ago

If unsure, use -dry before running it.

THERE IS NO CONFIRMATION. IF YOU RUN THIS TOOL, IT WILL DELETE STUFF. YOU HAVE BEEN WARNED.

Usage

Usage of ./docker-proper:
  -a="unix:///var/run/docker.sock": address of docker daemon
  -ca=672h0m0s: Max container age
  -dry=false: Dry run; do not actually delete
  -ia=672h0m0s: Max images age
  -r=0: Run continously in given interval
  -v=false: Be verbose

Docker image

I dockerize all the things, also this thing.

You can use it to remove stuff from local machine by bind-mounting the socket:

$ docker run --rm -v /var/run/docker.sock:/docker.sock dckr/docker-proper -a unix:///docker.sock

Or just specify a remote host by using -a.

You can also just use the image to pull out the docker-proper binary like this:

$ docker run --rm dckr/docker-proper --entrypoint cat /docker-proper/docker-proper > docker-proper

If you specify -r 24h the docker-proper and the container will sleep 24 hours and then repeat the cleanup. This is useful if you don't want to create a cronjob for this.

infra-docker-proper's People

Contributors

discordianfish avatar xbglowx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

infra-docker-proper's Issues

Do not untag images

Right now docker-proper tries to remove all images create a given time ago. Docker won't remove them if they are in use but it will untag them.

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.