Containers are great and I use them frequently. From GKE and Cloud Run through to ECS and EKS, Containers permeate my professional life.

So I tend to build up a lot of Docker mess and need to clean up every so often. So this is my cheat sheet to save me hitting up DuckDuckGo.

How much space is Docker using?

$ docker system df

Go verbose -v to get a better breakdown.

Just clean it all up

Clean up, but keep tagged images:

$ docker system prune

To get rid of as much as possible:

$ docker system prune -a

Prune specific items


$ docker image prune

-a for dangling images only.

Stopped containers:

$ docker container prune

Unused volumes:

$ docker volume prune