Today I learned how to clean stopped containers in Docker. Starting in Docker 1.13 a new prune
command has been introduced.
docker container prune
No one likes dangling images...
To list the numeric ids of dangling images dangling images use the filter with the dangling flag and -q
to surpress anything but IDs:
dangling_images=$(docker images -qf dangling=true)
Then delete the images
docker rmi $dangling_images
You can add those to a script and run it from time to time to reclaim hard drive space and some sanity.