How to remove multiple docker images with the same imageID?

后端 未结 8 2105
余生分开走
余生分开走 2021-01-30 20:15

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

相关标签:
8条回答
  • 2021-01-30 20:43

    You can use the command docker rmi IMAGE_NAME:TAG_NAME and it will work.

    0 讨论(0)
  • 2021-01-30 20:44

    I just checked in the Docker docs and i think this is something also can be done

    rmi

    You can remove an image using its short or long ID, its tag, or its digest. If an image has one or more tag or digest reference, you must remove all of them before the image is removed.

    so rather than using ID u can do something like this ---

    $ docker rmi test1 Untagged: test1:latest $ docker rmi test2 Untagged: test2:latest

    0 讨论(0)
  • 2021-01-30 20:46

    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.

    0 讨论(0)
  • 2021-01-30 20:47

    There are multiple ways you can delete.

    a) delete only one:

    $ sudo docker rmi login(REPOSITORY NAME):latest(TAG NAME)
    

    b) delete all with matching id with -f command:

    $ sudo docker rmi -f 91dfd8adbf04(IMAGE ID)
    
    0 讨论(0)
  • 2021-01-30 20:47

    You should try removing images using digest,

        $ docker images --digests
    
        REPOSITORY                     TAG       DIGEST                                                                    IMAGE ID        CREATED         SIZE
        localhost:5000/test/busybox    <none>    sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf   4986bf8c1536
    
        $ docker rmi localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
         Untagged: localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
    
        Deleted: 4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125
        Deleted: ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2
        Deleted: df7546f9f060a2268024c8a230d8639878585defcc1bc6f79d2728a13957871b
    
    0 讨论(0)
  • 2021-01-30 20:50

    Run the following command to remove multiple docker images with the same IMAGE ID.

    sudo docker rmi -f **IMAGE ID**
    
    0 讨论(0)
提交回复
热议问题