docker-rmi
Remove Docker images
TLDR
View documentation for the original command
SYNOPSIS
docker rmi [OPTIONS] IMAGE [IMAGE...]
PARAMETERS
--digest string
Delete image by digest (e.g., sha256:abc123...)
-f, --force
Force removal of image and dependent containers
--no-prune
Do not delete untagged parent images
DESCRIPTION
The docker rmi command removes one or more Docker images from the local repository. Images are identified by their repository name, tag, digest, or ID. This is useful for cleaning up unused images to free disk space and manage the image cache.
By default, docker rmi prevents removal if the image is referenced by a container (running or stopped). Use --force to override this, which stops and removes dependent containers first. The --no-prune option retains untagged parent images, while --digest allows precise removal by image digest.
It does not affect images on Docker Hub or remote registries; only local copies are deleted. After removal, dangling images (untagged and unreferenced) may remain unless pruned separately with docker image prune. Always verify images with docker images before deletion to avoid removing needed ones.
CAVEATS
Cannot remove images used by non-removed containers without --force, which is risky as it deletes containers too. Fails if image ID is invalid or image does not exist locally.
EXAMPLES
docker rmi myimage:latest
docker rmi --force abc123def456
docker rmi image1 image2 image3
EXIT CODES
0: success
1: failure (e.g., image in use, invalid ID)
HISTORY
Introduced in Docker 1.0 (2013) as part of core CLI for image lifecycle management; evolved with options like --force in Docker 1.6 and digest support in later versions.
SEE ALSO
docker images(1), docker image prune(1), docker image inspect(1), docker rmi(1)


