# docker-cleanup

- Description
- Usage
  - Default Mode
  - Sentinel Mode

# Description

`docker-cleanup` is a command to perform precommit's Docker cleanup functionality outside of patch and build testing.
It is designed to be run as a regularly automated job on CI systems that do not have their own Docker cleanup
facilities. It is built from the perspective that nothing on the system is permanent. It supports many of the same
options as `test-patch`'s docker-mode. Please see that page for more details.

# Usage

## Default Mode

Executing `docker-cleanup` with no additional options will perform the same work as the `--robot` option.

    $ docker-cleanup

    ...
            Removing old images
    ...
    Untagged: hadoop/createrelease:3.0.0-alpha3-SNAPSHOT_10600
    Deleted: sha256:1a96c79a0a9ab538c6c7765dc908eca3e689270b778d6ae2add558e89792a7d8
    ...
                           Docker Container Maintenance
    ...

## Sentinel Mode

`docker-cleanup` also supports the `--sentinel` mode to kill and remove stale running containers:

    $ docker-cleanup --sentinel

    ...
                                Removing old images
    ...
    Untagged: hadoop/createrelease:3.0.0-alpha3-SNAPSHOT_10600
    Deleted: sha256:1a96c79a0a9ab538c6c7765dc908eca3e689270b778d6ae2add558e89792a7d8
    ...

                           Docker Container Maintenance
    ...
    Attempting to remove docker container /big_kowalevski [5ffd22a56ebcfe38d72b9078e0e7133ab6dc054115a4804e504c910bdbdeea45]
    ...