I created a local docker registry and then pull some of my docker images from docker hub and then push them to the local registry. Now I want to remove my local images. But the problem here is that imageID
of the images are the same and I cannot remove them. I searched for the solution but I couldn't find the solution.
>> docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE localhost:5000/[repo1] v-0.9.1 810001cb03af 4 weeks ago 594.6 MB [myaccount]/[repo1] v-0.9.1 810001cb03af 4 weeks ago 594.6 MB
as you see the image ID
are the same for both images. How can I remove them?
EDIT
my docker version:
Docker version 1.8.2, build 0a8c2e3
output of docker rmi 810001cb03af
:
Error response from daemon: Conflict, cannot delete image 810001cb03af because it is tagged in multiple repositories, use -f to force Error: failed to remove images: [810001cb03af]
If I do docker rmi -f 81000
it will remove both of them and I need to pull again.
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.
Here is a way you could do this. Run the command:
docker images | grep 810001cb03af | awk '{print $1 ":" $2}' | xargs docker rmi
where 810001cb03af
is your image id.
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