sudo docker volume ls -qf dangling=true | xargs -r sudo docker volume rm && \
sudo docker network rm $(sudo docker network ls --format "{{.ID}} {{.Name}}" | grep -v "bridge" | awk '/ / { print $1 }') && \
sudo docker images --filter "dangling=true" -q --no-trunc | xargs -r sudo docker rmi && \
sudo docker images | grep "none" | awk '/ / { print $3 }' | xargs -r sudo docker rmi && \
sudo docker rm $(sudo docker ps -qa --no-trunc --filter "status=exited")
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ sudo docker volume rm $(sudo docker volume ls -qf dangling=true)
$ sudo docker volume ls -qf dangling=true | xargs -r sudo docker volume rm
$ sudo docker network ls
$ sudo docker network ls | grep "bridge"
$ sudo docker network rm $(sudo docker network ls | grep "bridge" | awk '/ / { print $1 }')
// see: http://stackoverflow.com/questions/32723111/how-to-remove-old-and-unused-docker-images
$ sudo docker images
$ sudo docker images --filter "dangling=true" -q --no-trunc | xargs -r sudo docker rmi
$ sudo docker images | grep "none"
$ sudo docker images | grep "none" | awk '/ / { print $3 }' | xargs -r sudo docker rmi
// see: http://stackoverflow.com/questions/32723111/how-to-remove-old-and-unused-docker-images
$ sudo docker ps
$ sudo docker ps -a
$ sudo docker rm $(sudo docker ps -qa --no-trunc --filter "status=exited")
$ sudo docker-machine create --driver virtualbox --virtualbox-disk-size "40000" default