How do I remove orphaned images?

An orphaned image is one without a tag and it is also not a parent of a tagged image. We also call these “dangling” images since they are not really connected to an image tree.

You can find all the orphaned images with docker images -f dangling=true.
To remove these images, use the -q flag to just list the image id’s and provide the list to docker rmi like this:

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

For more information on the filtering flag see: https://docs.docker.com/reference/commandline/cli/#filtering_2

What is this? We’re experimenting with forum postings as a way to publish FAQ’s.

dangling=true is cool, was not aware of that.

1 Like