docker rmi Explained

What docker rmi does, with an example.

Published November 8, 2026

docker rmi removes images from the local machine. An image in use by a container cannot be removed without -f.

How it works

Images can have multiple tags; removing a tag only deletes the image when no tags remain.

Dangling images (untagged leftovers) are cleaned with docker image prune.

Try it

docker rmi nginx:1.25
Untagged: nginx:1.25
Deleted: sha256:abc123

Practical examples

Remove an image

docker rmi myapp:1.0

Remove dangling images

docker image prune

Remove all unused images

docker image prune -a

Force

docker rmi -f IMAGE_ID

Common mistakes

  • Removing images used by containers.
  • Pruning all images and forcing re-downloads.
  • Confusing images with containers (rm vs rmi).

Key takeaways

  • docker rmi removes images from the local machine.
  • Run docker <command> --help for all options.
  • Clean up unused resources regularly.

FAQ

rm vs rmi?

rm deletes containers; rmi deletes images.

Where can I see all options?

Run the command with --help.

More General articles