Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove multiple docker images with the same imageID?

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.

like image 827
Hadi Avatar asked Oct 05 '15 08:10

Hadi


People also ask

How do I remove docker image referenced in multiple repositories?

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.


1 Answers

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.

like image 55
user2707671 Avatar answered Oct 08 '22 02:10

user2707671