Hi
I am trying docker rmi c565603bc87f
Error response from daemon: conflict: unable to delete c565603bc87f (cannot be forced) - image has dependent child images
So i can’t delete image even with -f flag. How to delete image then and all of its children ?
uname -a
Linux goracio-pc 4.4.0-24-generic #43-Ubuntu SMP Wed Jun 8 19:27:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
docker version
Client:
Version: 1.11.2
API version: 1.23
Go version: go1.5.4
Git commit: b9f10c9
Built: Wed Jun 1 22:00:43 2016
OS/Arch: linux/amd64
Server:
Version: 1.11.2
API version: 1.23
Go version: go1.5.4
Git commit: b9f10c9
Built: Wed Jun 1 22:00:43 2016
OS/Arch: linux/amd64
root@seltzer:~/docker# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
vm370suite705 latest e7dd249ea187 25 hours ago 1.271 GB
v01 latest 5c07b467adbd 5 days ago 1.271 GB
vm370suite latest 5c07b467adbd 5 days ago 1.271 GB
vm370suite_2016-07-05 latest 5c07b467adbd 5 days ago 1.271 GB
vm370suite_2016 latest 5c07b467adbd 5 days ago 1.271 GB
vm370suite_2016-06-30-7 latest ebb63b5a6bb0 5 days ago 1.271 GB
vm370suite_2016-06-30-6 latest e843e6b2c9fd 5 days ago 1.271 GB
vm370suite_2016-06-30-5 latest abc25f2ec8f2 5 days ago 1.168 GB
vm370suite_2016-06-30-4 latest 5050914ddc99 5 days ago 1.065 GB
vm370suite_2016-06-30-3 latest c105a959afa7 6 days ago 1.065 GB
vm370suite_2016-06-30-2 latest 46bee88ae25d 6 days ago 1.065 GB
nate/dockviz latest 3ee5f8ba9d07 3 weeks ago 6.091 MB
ubuntu latest 2fa927b5cdd3 5 weeks ago 122 MB
debian latest 1742affe03b5 6 weeks ago 125.1 MB
Note that the containers with the same key are:
root@seltzer:~/docker# docker images | grep adbd
v01 latest 5c07b467adbd 5 days ago 1.271 GB
vm370suite latest 5c07b467adbd 5 days ago 1.271 GB
vm370suite_2016-07-05 latest 5c07b467adbd 5 days ago 1.271 GB
vm370suite_2016 latest 5c07b467adbd 5 days ago 1.271 GB
These do not want to budge… see?
root@seltzer:~/docker# docker rmi 5c07b467adbd
Error response from daemon: conflict: unable to delete 5c07b467adbd (cannot be forced) - image has dependent child images
Hi there, i had the same problem than you, so i check on the internet and i made me sad that the answer exist on Stack over flows but not on the Docker’s forum.
open your terminal and enter :
docker inspect --format=’{{.Id}} {{.Parent}}’ $(docker images --filter since=<image_id> -q)
where you replace <image_id> by your image id (Yeah, man, obviously)
It will kill every children
then , write :
docker rmi <image_id>
if it tell you that it is link to a docker so remove it too with the command :
docker rm < docker_id>
and then go back to point 2) to end the process .
Edit: Solved!
You have to enter the full id (not a part of the id only), then the output will show some sha:256 hashes with one and the same id.
Then you can remove the image with
Please refer to the below command to fix the issue as i was facing the same error:
docker rmi < image id > -f
this will forcefully delete the children while removing image.
Hi there,
If you run the below command to see the docker hidden images in the background.
docker images -a
Search for the child image. Once that is confirmed, run the following image using the command:
docker rmi $(docker images -a | grep “< none>” | awk ‘{print $3}’)
This will remove all the unused images that are not being used.
Note: in the query above remove space before none in "< none>"
Why doesn’t docker simply have a command like `docker untag <tag or id>??? Deleting all images just to delete a stubborn/pregnant one seems like a bit of “Solomon’s Sword” IMHO.
If one or more tags point to an image id, it is not possible to delete the image by image id.
It becomes necessary to delete each tag with docker rmi ${repo}:${tag}, until one tag remains, which then can be deleted by either the tag or the image id. Only the last rmi acualy deletes image layers, every previous command in fact untags the “pointer” to the image id.
Thus said, I feel docker image rm | docker rmi already implement untag and remove. In case of ambiguity (n:>1 tags point to the image id), it will just untag otherwiese delete the image layers and meta-data.
From recent experience, I believe that you arrive at a “Catch-22” when the existing tag is <none>, however. Maybe it’s just me, but I have yet to figure out how to rmi such a null tagged object, especially when the prescient error text mentions ‘(cannot be forced).’
Indeed Catch-22. an image entry where multiple repo:tag <none>:<none> point to the same image id, can’t be deleted that way.
When an image is build with multiple tags, then re-build with multiple tags → this should create the scenario that @amondale refers to.
Well spoted! I have no idea how to delete those image entries, and if they are concidered as dangling images, and as such can be deleted with docker image prune. The last 7 years I have never been in the situation - though typicaly my images are build inside a disposable build container and pushed to a private repository.
Thanks for confirming, Metin! These none stragglers are artifacts of the docker pull command, or at least the docker pull, docker tag sequence. They cannot be pruned either; the only way to remove is to rmi the pulled image (which became the parent of the “non-dangling” <none> and then it can be rmi’ed by id, and the pull and tag commands re-issued. Not sure why the “ghost” image is being created, possibly as a backup, but I would think “untag” would be the right way to go for these images.