3

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
  • 4,017
  • 1
  • 29
  • 35

2 Answers2

6

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.

Nagev
  • 4,017
  • 1
  • 29
  • 35
1

you can reset the entire storage with podman system reset

Giuseppe Scrivano
  • 1,025
  • 8
  • 11
  • " $ 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. – Nagev Aug 17 '20 at 13:13
  • `podman system reset` was added recently. What version of Podman are you using? – Giuseppe Scrivano Aug 19 '20 at 07:39
  • 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 Aug 19 '20 at 11:07
  • Found it: http://docs.podman.io/en/latest/markdown/podman-system-reset.1.html – Nagev Aug 19 '20 at 11:14