Skip to content
Latchkey

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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →