I want to delete all Ubuntu images from Docker. Here is what docker images shows:
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
nginx test b585568733c7 3 weeks ago 93.46 MB
ubuntu 14.04 ce76de2e871b 4 weeks ago 188 MB
ubuntu 12.04 583364cb662d 4 weeks ago 138 MB
tommylau/ocserv latest 26d1014b5930 5 weeks ago 145.6 MB
nginx 1.7.11 520f1dbba9d6 12 months ago 93.44 MB
How can I delete ubuntu:14.04 and ubuntu:12.04 with a single command?
You cannot remove images having multiple repositories without the force modifier, see Docker docs for more info. If you use the -f flag and specify the image's short or long ID, then rmi untags and removes all images that match the specified ID.
To remove the image, you first need to list all the images to get the Image IDs, Image name and other details. By running simple command docker images -a or docker images . After that you make sure which image want to remove, to do that executing this simple command docker rmi <your-image-id> .
You can use
docker rmi $(docker images -q ubuntu)
-q
lists only the image id, and docker images -q ubuntu
lists all ubuntu
images' ids.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With