Skip to content
Latchkey

docker system prune: Reclaim Disk in CI

Reclaim disk by removing everything unused - the CI cleanup hammer.

docker system prune removes unused Docker data: stopped containers, dangling images, unused networks, and build cache. This page covers the aggressive flags safe for CI.

What it does

By default docker system prune removes stopped containers, networks not used by a container, dangling images, and dangling build cache. -a also removes all unused (not just dangling) images; --volumes adds unused volumes.

Common usage

Terminal
docker system prune -f
docker system prune -af                 # also unused images
docker system prune -af --volumes       # also unused volumes (CI hammer)

Common errors in CI

This is the standard fix for "no space left on device" on a runner: docker system prune -af --volumes between jobs. Without -f it prompts "Are you sure?" and hangs in non-interactive CI - always pass -f. Beware --volumes deletes data volumes you might still need; on shared runners scope cleanup to the current job rather than wiping everything.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →