useful docker commands for reclaiming space
derekeder opened this issue · comments
Derek Eder commented
Documentation request
Sometimes docker behaves weirdly and fails to build / restarts suddenly. This is typically because it ran out of hard drive space. We should document some helpful commands to reclaim space in docker. This stack overflow thread has some really helpful ones:
Delete the orphaned volumes in Docker
docker volume rm $(docker volume ls -qf dangling=true)
List dangling volumes:
docker volume ls -qf dangling=true
List all volumes:
docker volume ls
Delete unused images
Remove <none>
images that sometimes get generated when a Docker build is interrupted and then hang around:
docker rmi $(docker images | grep '^<none>' | awk '{print $3}')