Can’t delete docker image with dependent child images

前端 未结 19 2235
挽巷
挽巷 2020-12-02 06:11

I am trying

docker rmi c565603bc87f

Error:

Error response from daemon: conflict: unable to delete c565603bc87f (ca

19条回答
  •  难免孤独
    2020-12-02 06:46

    I had this issue and none of the short answers here worked, even in the page mentioned by @tudor above. I thought I would share here how I got rid of the images. I came up with the idea that dependent images must be >= the size of the parent image, which helps identify it so we can remove it.

    I listed the images in size order to see if I could spot any correlations:

    docker images --format '{{.Size}}\t{{.Repository}}\t{{.Tag}}\t{{.ID}}' | sort -h -r | column -t
    

    What this does, is use some special formatting from docker to position the image size column first, then run a human readable sort in reverse order. Then I restore the easy-to-read columns.

    Then I looked at the containers, and matched the first one in the list with a similar size. I performed a simple docker rmi on that image and all the child images went with it.

    The problem image with all the child images was actually the damn myrepo/getstarted-lab image I used when I first started playing with docker. It was because I had created a new image from the first test image which created the chain.

    Hopefully that helps someone else at some point.

提交回复
热议问题