How to force delete all podman images and children

14,594

Solution 1

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.

Solution 2

you can reset the entire storage with podman system reset

Share:
14,594
Nagev
Author by

Nagev

Updated on June 30, 2022

Comments

  • Nagev
    Nagev 11 months

    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?

  • Nagev
    Nagev almost 3 years
    " $ podman system reset Error: unrecognized command 'podman system reset' Try 'podman system --help' for more information. " However, podman system prune does remove dangling images and the build cache and can be followed by podman rmi --all to clean up the rest. You may want to update your answer, but I'll add to mine for completeness.
  • Giuseppe Scrivano
    Giuseppe Scrivano almost 3 years
    podman system reset was added recently. What version of Podman are you using?
  • Nagev
    Nagev almost 3 years
    I see, then it's fine, It can be helpful to other people. I have what apt gives me on Ubuntu 20.04.1 LTS: sudo apt-get install podman: podman is already the newest version (1.6.2-1~ubuntu19.04~ppa1). So I'll stick with 1.6.2 until they update it. Thanks.
  • Nagev
    Nagev almost 3 years