# docker system prune Command Reference

> Reference for docker system prune in CI: reclaim disk by removing stopped containers, unused networks, dangling images, and the build cache with -af.

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

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.

## FAQ

### docker system prune Command Reference?

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

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

---

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
