Nagev
Nagev

Reputation: 13285

How to force delete all podman images and children

When I do something like podman rmi d61259d8f7a7 -f it fails with a message: Error: unable to delete "vvvvvvvvvvvv" (cannot be forced) - image has dependent child images.

I already tried the all switch podman rmi --all which does delete some images but many are still left behind. How do I force remove all images and dependent child images in a single step?

Upvotes: 32

Views: 86163

Answers (3)

Gran Goza
Gran Goza

Reputation: 1

I found that I still had some images around after using the

podman system prune --all --force && podman rmi --all

For some of the images it gave this error:

    image used by 86...8: image is in use by a container: consider listing external containers and force-removing image

Adding the --force on the podman rmi command addressed that issue:

podman system prune --all --force && podman rmi --all --force

Upvotes: 0

Nagev
Nagev

Reputation: 13285

Inspired by a similar docker answer with a slight modification, adding the a was the missing magic in my case:

WARNING: This will delete every image! Please, check and double check that it is indeed what you need.

$ podman rmi $(podman images -qa) -f

Again, please use with caution and make sure you know what you're doing! Sharing here for my own future reference and hoping that it will save someone else some time.

Thanks to the hint by @Giuseppe Scrivano there's an alternative which may be more natural (previous warning applies):

podman system prune --all --force && podman rmi --all

See podman system prune --help for details. I have not yet had a chance to verify that this second method fixes the "image has dependent child images" error.

Upvotes: 58

Giuseppe Scrivano
Giuseppe Scrivano

Reputation: 1635

you can reset the entire storage with podman system reset

Upvotes: 29

Related Questions