Inspect before removing anything
docker system df -v
docker ps -a
docker volume lsCompare image, container, volume and build-cache usage. Reclaimable space is a diagnostic estimate, not a deletion preview. Inspect important containers with docker inspect <container> and check their mounts before cleanup.
Choose a targeted cleanup
| Command | What it removes | What to check |
|---|---|---|
docker image prune | Dangling images | Whether an old local build matters to you. |
docker container prune | All stopped containers | Their writable layers and configuration. |
docker builder prune | Eligible build cache | Whether rebuilding will be expensive. |
Run only the command that matches your goal and read its confirmation. Removing stopped containers loses data kept only in their writable layers. Bind-mounted files and volumes are separate storage.
Understand broader cleanup
docker system pruneThis broader command removes stopped containers, unused networks, dangling images and unused build cache. Volumes are not included by default. Adding -a also targets images not associated with any container, including tagged images you might otherwise reuse.
Omitting volume deletion does not guarantee that all application data survives: data stored only inside a removed container is lost. Back up important data first.
Verify the result and the limits
docker system df -v
docker ps -a
docker volume lsCheck that required volumes remain and that your application can access its data. Do not add --volumes or run docker volume prune as part of this workflow. docker compose down -v is also outside this cleanup plan.
Docker system prune has no dry-run option. On Docker Desktop, reduced Docker usage does not necessarily mean the virtual disk file immediately shrinks by the same amount.