Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to physically remove untagged docker images

Tags:

when I run a command such as sudo docker rmi me/myimage I get the responce ...image untagged, but, when I rerun sudo docker images I can see that this "untagged" image is still there, and, if I run df -h I can see that the actual files still exist and occupy the file system space. What command or procedure can I use to physically remove the unneeded images?

like image 509
Eugene Goldberg Avatar asked Feb 07 '15 01:02

Eugene Goldberg


People also ask

How do I remove all docker images without tags?

3.2. If we do not want to find dangling images and remove them one by one, we can use the docker image prune command. This command removes all dangling images. If we also want to remove unused images, we can use the -a flag.

How do I remove docker images?

Forcefully Remove Containers and ImagesThe -f flag is used to remove the running Docker containers forcefully. The docker images -qa will return the image id of all the Docker images. The docker rmi command will then remove all the images one by one. Again, the -f flag is used to forcefully remove the Docker image.

What is an untagged docker image?

From their documentation. This will display untagged images, that are the leaves of the images tree (not intermediary layers). These images occur when a new build of an image takes the repo:tag away from the IMAGE ID, leaving it untagged.


1 Answers

You should be able to remove untagged Docker images using the "dangling=true" flag:

sudo docker rmi $(sudo docker images -f "dangling=true" -q)

source:

https://docs.docker.com/engine/reference/commandline/images/

like image 200
John Petrone Avatar answered Oct 14 '22 20:10

John Petrone