Unable to Delete A Docker Image with Dependent Images

This post tells you how to delete a docker image with dependent images.

Problem Description

When trying docker rmi a12345678901, an error occurs as below.

1
Error response from daemon: conflict: unable to delete a12345678901 (cannot be forced) - image has dependent child images

Even if I add the flag -f, it also doesn’t work.


Root Cause

There are some dependent images so you cannot delete the image.


Solution

Remove unnecessary images.

1
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)

And then delete the image.

1
docker rmi a12345678901

References

Can’t delete docker image with dependent child images - stackOverflow

Buy a cup of coffee for the author.