How to Clean Up Docker Disk Space (Prune Containers, Images & Volumes)
Reclaim gigabytes of hard drive space by removing stopped containers, unused networks, dangling images, and build caches.
docker system prune -a --volumesStep-by-Step Execution Guide
docker system dfDisplays a breakdown of disk space consumed by Images, Containers, Local Volumes, and Build Cache.
docker system pruneDeletes stopped containers, networks not used by at least one container, and dangling images without tags.
docker system prune -a-a removes all unreferenced images, not just dangling ones.
docker system prune -a --volumes -fWARNING: Permanently deletes all stopped containers, unused images, build caches, and unattached volumes (-f bypasses prompt).
Critical Docker Pitfalls & Precautions
- β’Using "--volumes" will permanently erase database data stored in Docker volumes not currently attached to a running container!
- β’Make sure required containers are actively running before executing system prune.
Clean Up Docker Disk Space - Frequently Asked Questions
Common questions about container isolation, signal handling, and runtime behavior.
Run "docker builder prune -a" to remove multi-stage build cache without touching your images or volumes.
Related Docker Command Guides
Browse All Docker RecipesOpen an interactive terminal shell session inside a live running Docker container to inspect files, debug processes, or test network connectivity.
Instantly stop all active containers and optionally remove them with a single command.
Copy files or directories between a Docker container and your local host file system without creating a volume mount.
Understand the fundamental differences between ENTRYPOINT and CMD directives and how to combine them for flexible container CLIs.
Inspect stdout and stderr output from containers with timestamps, tail line limits, and live streaming.
Best practices for copying files into Docker images. Why COPY is almost always preferred over ADD.