Podman can not kill containers: not running, but state improper

When I run podman container kill -a, I get

can only kill running containers. 11d887d57069b3ee630fd6f1b13d600485c34f5020ff09fec65f4e31dd7242a5 is in state configured: container state improper
can only kill running containers. 2132c0543eedbe3c4ee8680da508fea6251d38107d5e707f260eb5aa8549409d is in state configured: container state improper
can only kill running containers. 2db317cc73ec92e434fda88653f872e4c4cf07e9f32c0c29ecc5e69515beb96d is in state exited: container state improper
can only kill running containers. 465d133dec7a568bd8a6231036e1c489b6a6f88c65154629d75ce4161fb6e3c4 is in state exited: container state improper

Subsequent runs still show the containers. How can I get rid of them?

Asked By: Evan Carroll

||

My guess is that this is a bug because containers that are not running should not be targeted with podman kill -a

I was able to get rid of these containers by running

podman container rm -fa
Answered By: Evan Carroll

I was able to fix by doing the following:

  1. in the error message it will say … is already in use by [long ID]. Copy that ID.
  2. type podman restart [ID]
  3. Type podman kill -a to kill all (this should now work), or use the command to kill a specific container.
Answered By: Joel M.

I have seen those issues only a few times. They are hard to get out of.

I found that the best was to try first

 $ podman container kill -fa

If that did not work, then use the really big hammer:

 $ podman system reset
 $ podman system reset     ; yes, twice.
 $ podman system renumber  ; gets rid of ...id already in use by...

I hope that helps! It saved me at a customer site!

Answered By: Traveler_3994
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.