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.0Remove dangling images
docker image pruneRemove all unused images
docker image prune -aForce
docker rmi -f IMAGE_IDCommon 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.