docker rmi: Remove Images & Reclaim Disk
Remove images to reclaim disk on a runner.
docker rmi (alias docker image rm) removes images. This page covers force removal, the image-in-use conflict, and reclaiming disk in CI.
What it does
docker rmi deletes one or more images from the local store. If a tag is one of several pointing at the same image ID, rmi untags it rather than deleting the layers.
Common usage
docker rmi myapp:old
docker rmi -f $(docker images -q) # remove all images
docker rmi $(docker images -f "dangling=true" -q)Common errors in CI
"conflict: unable to delete <id> (cannot be forced) - image is being used by running container" - stop and remove the container first (docker rm -f), then rmi. "image is referenced in multiple repositories" - remove by full name:tag rather than ID, or use -f. For broad cleanup in CI, docker image prune -af is usually simpler than rmi loops.