All Snippets

Docker Full System Cleanup

Reclaim disk space by pruning unused Docker images, containers, volumes, and networks in one shot.

Docker accumulates dangling images, stopped containers, and unused volumes over time. This one-liner wipes everything that isn't actively in use.

Nuclear cleanup (everything unused)bash
1
docker system prune -a --volumes -f

This removes ALL unused images (not just dangling ones), all stopped containers, all unused networks, and all unused volumes. Do not run this in production without understanding the impact.

If you want more control, run each step individually:

Step-by-step cleanupbash
1
# Remove stopped containers
2
docker container prune -f
3
 
4
# Remove unused images (dangling only)
5
docker image prune -f
6
 
7
# Remove unused images (all unused, not just dangling)
8
docker image prune -a -f
9
 
10
# Remove unused volumes
11
docker volume prune -f
12
 
13
# Remove unused networks
14
docker network prune -f

Run docker system df before and after to see how much space you reclaimed.