← All notes

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

Sources

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

Permanent ID: iil:note:3jg643ps

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

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-image-prune.md.