Remove All Images & Containers
Some helpful commands to clear down old Docker containers/images.
Update
As of 1.13.0, see the new prune commands:
# Commands docker container prune # Remove all stopped containers docker volume prune # Remove all unused volumes docker image prune # Remove unused images docker system prune # All of the above, in this order: containers, volumes, images
Extra:
docker system df # Show docker disk usage, including space reclaimable by pruning
Using Powershell (windows)
Remove all containers:
docker ps -a -q | % { docker rm $_ }
Remove all images:
docker images -q | % { docker rmi $_ }
From bash (Linux type systems)
Remove all containers:
docker rm $(docker ps -a -q)
Remove all images:
docker rmi $(docker images -q)
Remove all volumes:
docker volume rm $(docker volume ls -f dangling=true -q)