#!/bin/sh

`docker ps | grep 'hour ago' | awk '{print $1}' | xargs docker kill` > /dev/null
`docker ps | grep 'hours ago' | awk '{print $1}' | xargs docker kill` > /dev/null
`docker ps | grep 'day ago' | awk '{print $1}' | xargs docker kill` > /dev/null
`docker ps | grep 'days ago' | awk '{print $1}' | xargs docker kill` > /dev/null
`docker ps | grep 'week ago' | awk '{print $1}' | xargs docker kill` > /dev/null
`docker ps | grep 'weeks ago' | awk '{print $1}' | xargs docker kill` > /dev/null

#!/bin/sh

containers=$(docker ps | grep '\([3-9][0-9] minutes\|hour\|day\)')

if [ -n "$containers" ]; then
    docker ps | grep '\([3-9][0-9] minutes\|hour\|day\)' | awk '{print $1}' | xargs docker kill
fi

Kill containers will only kill containers that have been alive for at least 30 minutes now
Kill containers will only kill containers that have been alive for at
least 30 minutes now
