Unable to delete some untagged docker images due to conflict

浪子不回头ぞ 提交于 2019-12-21 17:24:40

问题


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.


回答1:


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.




回答2:


The container should be stopped first before you can remove the image :

docker rm $(docker ps -a -q)

Source : https://github.com/docker/docker/pull/6112




回答3:


It happen to me also and restarting the docker engine and all the containers using this image solve the issue.



来源:https://stackoverflow.com/questions/33921770/unable-to-delete-some-untagged-docker-images-due-to-conflict

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!