About
Docker host disk sizing management.
Docker stores all layers/images in its file formate (i.e. aufs) in default /var/lib/docker directory.
Management
Show space
docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 16 3 3.774GB 2.227GB (59%)
Containers 5 0 233.1MB 233.1MB (100%)
Local Volumes 2 1 35.73MB 0B (0%)
Containers
Remove the container that where not used months ago
docker ps --filter "status=exited" | grep 'months ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm
See also: docker container prune
Images
Untagged
Ie with the tag none.
docker rmi $(docker images -q -f dangling=true)
# or
docker image ls | grep 'none' | awk '{print $3}' | xargs --no-run-if-empty docker image rm
Old
docker image ls | grep 'months ago' | awk '{print $1"\:"$2}' | xargs --no-run-if-empty docker image rm
Volume
Orphaned / Unused
To delete orphaned volumes in Docker 1.9 and up
docker volume prune
Dangling volume
docker volume rm $(docker volume ls -qf dangling=true)
System
clean up containers, images, volumes, and networks all in one command.