docker rmi
Remove one or more images. Containers using the image must be removed first.
Syntax
docker rmi [OPTIONS] IMAGE [IMAGE...]
Examples
Example 1
docker rmi nginx:latest
Remove a specific image.
Example 2
docker rmi -f myimage:tag
Force remove (even if in use by containers).
Example 3
docker rmi $(docker images -q)
Remove all images (use with caution).
Common flags
| Flag | Description |
|---|---|
| -f, --force | Force removal |
| --no-prune | Do not delete untagged parents |
Tips & best practices
- •Remove containers before images they use.
- •Use docker image prune for dangling images.