How to delete docker image with dependent child images

Today, I can’t delete docker images with dependent child images. How to delete docker image with dependent child images.

I want to delete image e16184e8dd39

[vagrant@localhost docker-flask-app]$ docker images
REPOSITORY             TAG       IMAGE ID       CREATED        SIZE
python                 3.6       e16184e8dd39   9 days ago     902MB
mysql                  5.7       938b57d64674   2 weeks ago    448MB
docker-flask-app_app   latest    44ae2f35ec29   3 weeks ago    915MB
<none>                 <none>    0e0359a5ec25   3 weeks ago    908MB
<none>                 <none>    3a59efe32b9c   3 weeks ago    908MB
postgres               latest    6ce504119cc8   5 weeks ago    374MB
odoo                   14        4f53998176ca   5 weeks ago    1.41GB
postgres               <none>    346c7820a8fb   2 months ago   315MB

I am trying with command as below

sudo docker rmi e16184e8dd39

Error delete docker image with dependent child images

[vagrant@localhost docker-flask-app]$ sudo docker rmi e16184e8dd39
Error response from daemon: conflict: unable to delete e16184e8dd39 (cannot be forced) - image has dependent child images
[vagrant@localhost docker-flask-app]$
delete docker image with dependent child images

I can not delete an image with the -f flag.

How to Fixed it

You should try to remove unnecessary images before removing the image:

[vagrant@localhost docker-flask-app]$ docker rmi $(docker images -q) -f

The output terminal as below

delete docker image with dependent child images

Note: This command above will remove images all.

After you remove the image.

docker rmi -f e16184e8dd39

Conclusion

You have to delete the docker image with dependent child images I hope will this your helpful. Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology, especially Devops Skill such as Docker, vagrant, git, and so forth. I like open-sources, so I created DevopsRoles.com to share the knowledge I have acquired. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

2 thoughts on “How to delete docker image with dependent child images

  1. The title was “how to delete docker image with dependent child images”, but actually you delete all images. That’s not a solution to the problem in the title

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.