← All notes

Docker prune commands (system, image, volume, build cache)

Answer: Run docker system prune to remove stopped containers, unused networks, dangling images and unused build cache; add -a for all unused images and --volumes for unused anonymous volumes. Docker does not remove unused objects unless you explicitly ask it to.

Examples

docker system df
docker image prune -a --filter "until=24h"
docker volume prune --all
docker buildx prune
docker system prune -a --volumes -f
docker system prune --filter "label!=keep"

Commands

| Command | Removes by default | |---|---| | docker image prune | dangling images (untagged and unreferenced) | | docker container prune | all stopped containers | | docker volume prune | anonymous unused volumes; named ones need --all | | docker network prune | networks not used by any containers | | docker buildx prune | build cache for the current builder | | docker system prune | stopped containers, unused networks, dangling images, unused build cache |

Flags for system prune

| Option | Description | |---|---| | -a, --all | remove all unused images, not just dangling ones | | --volumes | prune anonymous volumes | | -f, --force | do not prompt for confirmation | | --filter | filter values such as until=24h or a label |

Rules

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker docs, Prune unused Docker objects; Docker CLI reference, docker system prune. Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Docker docs, Prune unused Docker objects; Docker CLI reference, docker system prune. Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc.

Cite this

Permanent ID: iil:note:bhatdk94

iinventedlight. 2026. "Docker prune commands (system, image, volume, build cache)." iinventedlight Library, iil:note:bhatdk94, version of 2026-11-18. https://iinventedlight.com/library/notes/docker-system-prune/. License: CC-BY-4.0.

@misc{iil_note_bhatdk94,
  author = {{iinventedlight}},
  title = {{Docker prune commands (system, image, volume, build cache)}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-18},
  url = {https://iinventedlight.com/library/notes/docker-system-prune/},
  note = {Permanent ID iil:note:bhatdk94. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/docker-system-prune.md.