Skip to main content

Keep docker hosts tidy.

Project description

Keep docker hosts tidy.


There are three installation options


docker pull yelp/docker-custodian
docker run -ti \
    -v /var/run/docker.sock:/var/run/docker.sock \
    yelp/docker-custodian dcgc --help

Debian/Ubuntu package

First build the package (requires dh-virtualenv)

dpkg-buildpackage -us -uc

Then install it

dpkg -i ../docker-custodian_*.deb


pip install git+


Remove old docker containers and docker images.

dcgc will remove stopped containers and unused images that are older than “max age”. Running containers, and images which are used by a container are never removed.

Maximum age can be specificied with any format supported by pytimeparse.


dcgc --max-container-age 3days --max-image-age 30days

Prevent images from being removed

dcgc supports an image exclude list. If you have images that you’d like to keep around forever you can use the exclude list to prevent them from being removed.

    Never remove images with this tag. May be specified more than once.

    Path to a file which contains a list of images to exclude, one
    image tag per line.


Stop containers that have been running for too long.

dcstop will docker stop containers where the container name starts with –prefix and it has been running for longer than –max-run-time.


dcstop --max-run-time 2days --prefix "projectprefix_"

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
docker_custodian-0.6.1.tar.gz (4.6 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page