Cleaning Up Disk Space

Intermediate

Overview

Docker accumulates stopped containers, dangling images, unused networks, and orphaned volumes over time, which can quietly fill your disk.

docker system df shows what is using space. docker system prune removes unused data; add -a to also remove unused images, and --volumes to include volumes.

Be careful: pruning volumes deletes data. Always check what will be removed before confirming.

Cheatsheet

docker system dfShow Docker disk usage
docker container pruneRemove all stopped containers
docker image prune -aRemove unused images
docker volume pruneRemove unused volumes (careful!)
docker system prune -aRemove all unused data

Try it

A safe, simulated terminal. Run the suggested commands to see typical output.

simulated terminal

Type a command and press Enter, or click a suggestion below to run it.

$

Quick quiz

1. Which command shows how much disk space Docker is using?

2. What is risky about `docker volume prune`?