docker image prune: remove unused images
Answer: docker image prune removes unused images. By default it removes all dangling images. With --all, it also removes images not referenced by any container.
Default and --all
--force skips the confirmation prompt.
--all will remove all unused images, not just dangling ones.
If -a is specified, also remove all images not referenced by any container.
The default action is to remove all dangling images.
Filters
The --filter flag format is of key=value. Pass multiple flags when more than one filter is required.
Different keys combine with AND logic, so an image must satisfy every condition before it is pruned.
The same key combines with OR logic, so a match on any of those values is enough.
Supported filters are until, which drops images created before a timestamp, and label, including label!= forms.
until accepts Unix timestamps, date formatted timestamps, or Go duration strings such as 10m or 1h30m, computed relative to the daemon machine's time.
Even with --filter, the confirmation prompt still warns that all dangling images will be removed.
See also
Claims
- id: C1 claim: By default, prune removes all dangling images. source: S1 evidence: "Remove all dangling images"
- id: C2 claim: --all also removes images not referenced by any container. source: S1 evidence: "remove all images not referenced by any container"
- id: C3 claim: --force does not prompt for confirmation. source: S1 evidence: "Do not prompt for confirmation"
- id: C4 claim: Filters with different keys are combined using AND logic. source: S2 evidence: "combined using AND logic"
- id: C5 claim: until accepts Unix timestamps or Go duration strings such as 10m. source: S1 evidence: "Unix timestamps, date formatted timestamps, or Go duration strings"
Sources
- [S1] docker image prune. Docker Docs. https://docs.docker.com/reference/cli/docker/image/prune/ . License: Apache-2.0. Accessed 2026-11-23.
- [S2] docker image prune CLI reference. Docker CLI. https://raw.githubusercontent.com/docker/cli/master/docs/reference/commandline/image_prune.md . License: Apache-2.0. Accessed 2026-11-23.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker Docs, docker image prune; Docker CLI, docker image prune CLI reference. Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Apache-2.0 (https://raw.githubusercontent.com/docker/cli/master/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, docker image prune; Docker CLI, docker image prune CLI reference. Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Apache-2.0 (https://raw.githubusercontent.com/docker/cli/master/LICENSE). Copyright Docker, Inc.
Cite this
iinventedlight. 2026. "docker image prune: remove unused images." iinventedlight Library, iil:note:3jg643ps, version of 2026-11-23. https://iinventedlight.com/library/notes/docker-image-prune/. License: CC-BY-4.0.
@misc{iil_note_3jg643ps,
author = {{iinventedlight}},
title = {{docker image prune: remove unused images}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-23},
url = {https://iinventedlight.com/library/notes/docker-image-prune/},
note = {Permanent ID iil:note:3jg643ps. License: CC-BY-4.0.},
}
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.
- docker-image-prune.schema.json (schema; CC-BY-4.0)
- docker-image-prune.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/docker-image-prune.md.