Ad space (banner)
AD

Got the fundamentals? A structured Docker course is a fast way to level up.

Find Docker courses on Udemy

Affiliate link. Costs you nothing extra.

🐳Docker Lessons
Lesson 45 / 45

Cleaning Up with docker system prune

When Docker has quietly eaten your disk, use docker system prune. It removes stopped containers, unused networks and dangling images in one go.

The syntax is docker system prune. It asks for confirmation; -f skips the prompt, and -a also removes images no container uses.

Running docker system prune -f deletes the accumulated stopped containers and unused networks, then reports how much space it reclaimed.

A common stumble is reaching for -a without thinking and deleting images you will immediately have to download again. Check what exists first.

In real work, it is regular maintenance on development machines and CI servers, where build artifacts pile up fast.

Docker
Try it (type this into the pseudo terminal)
docker system prune -f

🧑‍💻 You can type this command into the Docker pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)