Search code examples
dockerdockerfiledocker-registry

Unable to delete some untagged docker images due to conflict


I am unable to explicitly delete some untagged docker images. Specifically, those with the tag <none>.

If I run docker images -a I get something like this:

<none>              <none>              91e54dfb1179        3 months ago        188.3 MB
<none>              <none>              d74508fb6632        3 months ago        188.3 MB
<none>              <none>              c22013c84729        3 months ago        188.3 MB
<none>              <none>              d3a1f33e8a5a        3 months ago        188.1 MB
<none>              <none>              4a5e6db8c069        3 months ago        125.1 MB
<none>              <none>              2c49f83e0b13        3 months ago 

However, when I type docker rmi -f 2c49f83e0b13 I get:

Error response from daemon: Conflict, 2c49f83e0b13wasn't deleted
Error: failed to remove images: [2c49f83e0b13]

Any idea what could be the problem?

These might be intermediary docker images for some images I'm actually using. But if that's the case, then the completed docker images should already have those prior images and I don't explicitly need those intermediary images to be there.


Solution

  • Make sure the image is actually dangling (meaning it is not referenced by any other image, or is not parent of an image)

    docker images --filter "dangling=true" -q --no-trunc
    

    If it is dangling (and should be removed), then there is a couple of pending bug reporting the impossibility to delete such images: issue 13625, issue 12487.