Skip to content
LatchkeyLatchkey home

docker rmi Command Reference

Remove one or more images.

docker rmi deletes images from the local store, reclaiming the disk their layers occupy. In CI it is used to clear dangling images or to free space mid-pipeline on disk-constrained runners.

Common flags

  • -f, --force - remove even if referenced by a stopped container or multiple tags
  • --no-prune - do not delete untagged parent images

Example

shell
docker rmi myorg/app:old
docker rmi -f $(docker images -q --filter "dangling=true")

In CI

Use docker rmi with docker images -q --filter dangling=true to reclaim untagged layers, or docker system prune for a broader sweep. "image is being used by running container" means a container still references it; stop and rm the container first or use -f.

Key takeaways

  • rmi removes images and reclaims their layer disk usage.
  • Combine with docker images -q --filter dangling=true to clear untagged layers.
  • A referencing container blocks removal unless you use -f.

Frequently asked questions

docker rmi Command Reference?
docker rmi deletes images from the local store, reclaiming the disk their layers occupy. In CI it is used to clear dangling images or to free space mid-pipeline on disk-constrained runners.
In CI?
Use docker rmi with docker images -q --filter dangling=true to reclaim untagged layers, or docker system prune for a broader sweep. "image is being used by running container" means a container still references it; stop and rm the container first or use -f.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card