Linux command
docker-image-rm 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Remove an image
docker image rm [image]
Remove multiple images
docker image rm [image1] [image2]
Force remove
docker image rm -f [image]
Remove by image ID
docker image rm [image_id]
说明
docker image rm removes one or more images from the local Docker image cache, freeing disk space occupied by their layers. Images can be specified by repository:tag or by their unique image ID. An image cannot be removed if any containers (running or stopped) depend on it, unless the -f force flag is used. Forcing removal of an image that containers depend on can lead to issues when those containers are restarted, as they will be unable to access their image layers. When an image is removed, Docker also removes any untagged parent images that are no longer referenced by other images, unless --no-prune is specified. This automatic cleanup helps maintain a lean image cache.
参数
- -f, --force
- Force removal.
- --no-prune
- Do not delete untagged parents.
FAQ
What is the docker-image-rm command used for?
docker image rm removes one or more images from the local Docker image cache, freeing disk space occupied by their layers. Images can be specified by repository:tag or by their unique image ID. An image cannot be removed if any containers (running or stopped) depend on it, unless the -f force flag is used. Forcing removal of an image that containers depend on can lead to issues when those containers are restarted, as they will be unable to access their image layers. When an image is removed, Docker also removes any untagged parent images that are no longer referenced by other images, unless --no-prune is specified. This automatic cleanup helps maintain a lean image cache.
How do I run a basic docker-image-rm example?
Run `docker image rm [image]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -f, --force do in docker-image-rm?
Force removal.