Go to file
John Schrantz 773f97d450 Automatically determine the Docker API version to use instead of assuming the latest. 2015-09-02 12:58:04 -05:00
debian Add changelog for 0.5.0 release. 2015-07-21 11:15:12 -07:00
docker_custodian Automatically determine the Docker API version to use instead of assuming the latest. 2015-09-02 12:58:04 -05:00
tests Support excluding some images from removal. 2015-07-20 15:41:11 -07:00
.gitignore Adding project files 2015-07-08 12:33:52 -07:00
.pre-commit-config.yaml Adding project files 2015-07-08 12:33:52 -07:00
.travis.yml Add .travis.yml 2015-07-14 13:28:28 -07:00
LICENSE Adding project files 2015-07-08 12:33:52 -07:00
Makefile Adding project files 2015-07-08 12:33:52 -07:00
README.rst Fix readme formatting. 2015-08-08 16:28:14 -04:00
requirements.txt Adding project files 2015-07-08 12:33:52 -07:00
setup.py Update tagline. 2015-07-10 12:52:21 -07:00
tox.ini Add .travis.yml 2015-07-14 13:28:28 -07:00

README.rst

Docker Custodian
================

.. image:: https://travis-ci.org/Yelp/docker-custodian.svg
    :target: https://travis-ci.org/Yelp/docker-custodian

Keep docker hosts tidy.


.. contents::
    :backlinks: none



dcgc
----

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 <https://github.com/wroberts/pytimeparse>`_.

Example:

.. code:: sh

    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.

::

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

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



dcstop
------

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`.


Example:

.. code:: sh

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