Your build host is running out of disk space, and docker prune looks like the quick fix. The important detail: there is no single `docker prune` command. Docker provides pruning commands for specific resources and a broader `docker system prune` command. Start with `docker system df`, then remove only what you understand. In particular, treat volumes as application data, not disposable clutter.
What docker prune actually means
Docker accumulates stopped containers, unused images, networks, volumes, and build cache. The commands below remove different subsets of those resources. Run them on the Docker daemon that owns the disk you want to clean; your active Docker context may point to a remote host or Docker Desktop rather than the machine where you typed the command.
For a first look, run `docker system df`. Add `-v` for a more detailed breakdown: `docker system df -v`. These reports help identify what Docker considers reclaimable, but they are not a promise that every byte will be returned to the host filesystem immediately. Image layers can be shared, and Docker Desktop may store data inside a virtual disk.
The general cleanup command is `docker system prune`. By default, it removes stopped containers, unused networks, dangling images, and unused build cache. Docker prompts for confirmation before deleting. Read the warning rather than adding `-f` on the first run; `-f` skips the prompt, not the consequences.
A dangling image is typically an untagged image no longer referenced by a container. An unused image is broader: it is not referenced by any container, even if it still has a useful tag. That distinction matters when you keep a local image as a rollback option or want to avoid pulling a large inference image again.

Choose a narrower docker prune command
If stopped containers are the problem, `docker container prune` removes all stopped containers after confirmation. Check `docker ps -a` first. A stopped container may hold logs, configuration clues, or files written to its writable layer. Removing the container removes that layer; copy anything you need before cleanup.
For dangling images only, use `docker image prune`. To remove all images not referenced by any container, use `docker image prune -a`. The latter can reclaim more space, but a future deployment may need to pull or rebuild those images. A stopped container still references its image, so an image may become eligible only after that container is removed.
For networks, `docker network prune` removes networks not used by at least one container. An unused custom network can still be part of a deployment setup, so inspect your environment before cleaning a shared host. Docker's built-in networks are not pruned.
Build cache has its own command: `docker builder prune`. This is useful on a build machine where repeated image builds have left substantial cache behind. The tradeoff is build time: the next build may need to repeat steps or download dependencies. On setups using Buildx, `docker buildx prune` manages the cache of the selected builder; inspect the builder and its options before assuming it is the same cache as your usual build workflow.
Use docker prune filters to limit cleanup
Many prune commands support filters, but the available filters differ by resource. For example, `docker container prune --filter "until=24h"` limits removal to stopped containers created before that cutoff. It does not mean containers stopped more than 24 hours ago. Check a command's `--help` output for the filters it accepts and how it interprets them.
You can also use `docker image prune -a --filter "until=168h"` to target unused images created before seven days ago. An old image can still be valuable, and image creation time is not the same as the last time you deployed it. On a production host, confirm your rollback plan before running that command.
For a broad cleanup with the same kind of age limit, `docker system prune --filter "until=24h"` is an option. It is still a cross-resource operation, and the filter does not make every resource safe to remove. Review the prompt and the resources involved first.

Volumes need a separate safety check
Docker does not prune volumes by default with `docker system prune`. Adding `--volumes` includes unused anonymous volumes, which can contain data you expected to keep. Do not assume an anonymous volume is empty just because no container currently uses it.
The standalone `docker volume prune` command removes unused anonymous local volumes by default. With `docker volume prune -a`, unused named local volumes are included too. Depending on your setup, those volumes might hold a database, uploaded files, or downloaded model artifacts. A volume is considered unused when no container references it; that is not the same as its contents being unimportant.
Before removing volumes, list them with `docker volume ls` and inspect candidates with `docker volume inspect VOLUME_NAME`. Check your Compose files or deployment configuration to understand what should be attached, and verify a restorable backup for persistent data. Do not use a prune command as a substitute for a backup or retention policy.
A practical cleanup sequence
On a development machine, I would start with `docker system df -v`, inspect stopped containers with `docker ps -a`, and choose the narrowest command that addresses the largest disposable category. If build cache is the issue, prune that cache rather than deleting containers and images as collateral cleanup. Run `docker system df` again afterward to see what changed.
On a shared production host, coordinate with the people or automation responsible for deployments. Confirm the active context with `docker context show`, check whether old images are needed for rollback, and avoid automatic volume pruning. If disk pressure persists, inspect non-Docker consumers too: application logs, host files, and external storage will not disappear just because Docker reports a successful cleanup.
For scheduled maintenance, use resource-specific commands and filters only after you understand their scope. Record the command, the target host, and disk usage before and after. No panic, just logs.
No letters yet — be the first to write.