# docker system prune: Reclaim Disk in CI

> How docker system prune works: removing stopped containers, unused networks, dangling images, and build cache, with the -a and --volumes flags.

Source: https://latchkey.dev/learn/command-reference/docker-system-prune-command  
Updated: 2026-06-25

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.

## FAQ

### docker system prune: Reclaim Disk in CI?

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 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.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
