Since docker v1.13, a few new commands were added
# shows used space, similar to the unix tool df
$ docker system df
# Removes all unused containers, volumes, networks and images (both dangling and unreferenced)
$ docker system prune
More about those commands: docs.docker.com/engine/reference/commandline/syst…
You should use docker-gc by Spotify, it's a garbage collector for docker images and containers.
Anthony Lapenna
Open-source enthusiast
Nice, note that you can use the following one-liners too:
# Remove all dangling images (unused images) $ docker rmi $(sudo docker images -q -f "dangling=true") # Remove all dangling volumes (unused volumes) $ docker volume rm $(docker volume ls -q -f "dangling=true")