I’ve found that docker system df
shows the large RECLAIMABLE space for me.
In order to save the space, I know that docker image prune -a
will remove all unused images.
However, I’d like to know the list before pruning for the safety.
Is there any way to list all images those are currently not being used by any container? (The images that will be deleted by docker image prune -a
)
I have searched for it but there are only pruning methods, no listing methods.
2
Answers
So to fetch all the unused docker images without actually pruning them, you could do the following
Fetch all the images belonging to the running containers(which are not stopped or exited)
Fetch all the images on the machine
Then filter the images in step 1 from step 2
Below are the shell commands
you can use this command to show all of images:
You can find unused images using the command:
and just a list of their IDs:
In case you want to delete them: