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?
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.
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.
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.
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/
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