Deletes automatically the containers (including the volumes) that are not running and don't have restart policy.
This is particularly useful to clean completed tasks/jobs on Amazon Web Services ec2 instances.
docker run -it --rm \
-v /run/docker.sock:/tmp/docker.sock \
cecton/container-cleaner --loop-delay=5 --dry-run
-
--dry-run -n
perform a trial run with no changes made
-
--loop-delay
sleep a certain delay in seconds (0 to disable, this is the default)
-
--min-age
only clean containers stopped since a certain time in seconds (0 to disable, this is the default)