docker system prune Command Reference
Remove unused Docker data to reclaim disk.
docker system prune removes stopped containers, unused networks, dangling images, and dangling build cache. With -a it also removes all unused (not just dangling) images, and --volumes adds anonymous volumes. It is the go-to fix for "no space left on device".
Common flags
-a, --all- remove all unused images, not only dangling ones-f, --force- do not prompt for confirmation--volumes- also remove unused anonymous volumes--filter- limit by condition, e.g. until=24h
Example
shell
docker system prune -af
docker system prune -af --volumes --filter "until=24h"In CI
Run docker system prune -af when a build fails with "no space left on device" on a long-lived runner, or proactively at job start. Be careful with -a: it removes images not used by a running container, including ones you may rely on for the next step. Ephemeral runners rarely need this since the disk is discarded after the job.
Key takeaways
- -af force-removes all unused images plus stopped containers, networks, and dangling cache.
- --volumes additionally clears anonymous volumes.
- It is the standard remedy for "no space left on device" on persistent runners.
Related guides
docker rmi Command ReferenceReference for docker rmi in CI: remove one or more images with -f to reclaim disk on runners and clear dangli…
docker rm Command ReferenceReference for docker rm in CI: remove one or more containers with -f and -v to force-stop and clean up volume…
docker volume Command ReferenceReference for docker volume in CI: create, list, inspect, remove, and prune named volumes for persisting or s…