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
docker images Command ReferenceReference for docker images in CI: list local images with --filter, --format, and -q to inspect or script ove…
docker rm Command ReferenceReference for docker rm in CI: remove one or more containers with -f and -v to force-stop and clean up volume…
docker system prune Command ReferenceReference for docker system prune in CI: reclaim disk by removing stopped containers, unused networks, dangli…