There is a container that I cannot stop. TL;DR the solution that worked for me was rebooting the host system.
Anyhow, I’ll share the troubleshooting steps that did not work.
❯ podman stop semaphore-postgres
WARN[0010] StopSignal SIGINT failed to stop container semaphore-postgres in 10 seconds, resorting to SIGKILL
Error: given PID did not die within timeout
❯ podman ps -a | grep semaphore-postgres
a688a42c4c15 docker.io/library/postgres:16 postgres 17 minutes ago Stopping 0.0.0.0:3000->3
000/tcp semaphore-postgres
Instead of “If at first you can’t stop a container, try, try again”, can we just kill
it?
❯ podman kill semaphore-postgres
semaphore-postgres
❯ podman ps -a | grep semaphore-postgres
a688a42c4c15 docker.io/library/postgres:16 postgres 21 minutes ago Stopping 0.0.0.0:3000->3
000/tcp semaphore-postgres
Trying to remove the container:
❯ podman rm semaphore-postgres
Error: cannot remove container a688a42c4c15950a34b0bdbcb6f0603a530787b562addff7ea3a2b6e6335d0a3 as it is stopping - running or paused
containers cannot be removed without force: container state improper
❯ podman rm -f semaphore-postgres
WARN[0014] StopSignal SIGINT failed to stop container semaphore-postgres in 10 seconds, resorting to SIGKILL
Error: cannot remove container a688a42c4c15950a34b0bdbcb6f0603a530787b562addff7ea3a2b6e6335d0a3 as it could not be stopped: given PID
did not die within timeout
It can’t be stopped or killed. I guess, I can try rebooting the system.
❯ sudo reboot
...
❯ podman ps | grep semaphore-postgres
1d9464e2117f docker.io/library/postgres:16 postgres About a minute ago Up About a minute 0.0.0.0:3000->3000/tcp
So what was causing the container to be in ‘stopping’ state in the first place? Well, earlier this evening, I was dumping and importing a database from postgres 14 to 16. Part of the process requires me to stop and start a systemd service used to stop/start this postgres container.
Since the app that depends on this postgres database is working again, it’s good enough for now. If I am able to find a way to stop or get rid of the stopping container, I’ll update this post.