Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically stopping containers - does it actually work? #72

Open
debarshiray opened this issue Sep 16, 2021 · 1 comment
Open

Automatically stopping containers - does it actually work? #72

debarshiray opened this issue Sep 16, 2021 · 1 comment

Comments

@debarshiray
Copy link

debarshiray commented Sep 16, 2021

This is in the context of containers/toolbox#114

I saw that coreos/toolbox always calls podman stop once the podman exec session terminates. I suppose the idea is that the stop will continue to fail until there are other exec sessions around, and the final stop will actually terminate the container.

But, does it actually work this way in practice?

I was playing with this a bit recently. It seems that regardless of whether there are exec sessions around or not, stop always sends a signal to the container's entry point.

For example, if you have:

$ podman run --rm -it registry.fedoraproject.org/fedora:34 /bin/bash

... then a podman stop ... will quit the shell.

Sometimes, when there are actual exec sessions around, I do get this error from podman stop:

"container %s has active exec sessions, refusing to clean up"

... but it doesn't seem consistent. Sometimes the exec sessions also end up getting terminated.

Any thoughts? :)

Is this the expected behaviour? Did Podman change behaviour in some way? Or am I missing something obvious?

@castedo
Copy link

castedo commented Dec 31, 2021

I tried doing this "blind" podman stop in https://github.com/castedo/cnest but I was seeing unexpected behavior where the container (running sleep +Inf) was getting getting stopped even though podman exec sessions were still running. So I'm now testing this podman inspect to test for how many exec sessions are still running:
https://github.com/castedo/cnest/blob/c76c5b0dfb08f9f5db6ddcc2b7ec66c8b84a5335/bin/cnest#L43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants