blob: d932bdce6e2bcc14003fba6ed186950f53b3ddbe [file] [log] [blame]
#!/usr/bin/env bash
# source colors
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${dir}/colorizer-lib/colorizer.sh"
function clean_docker(){
# clean
colorize "<blue>Hold tight... cleaning...</blue>"
docker rmi $(docker images --filter=dangling=true -q)
if [[ $1 == "--hard" ]]; then
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
else
# remove exited containers
docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs docker rm
fi
colorize "<yellow>Docker is now all clean.</yellow>"
}
clean_docker $@