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

cmd/run, pkg/podman: Stop container once the last session finishes #1213

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

debarshiray
Copy link
Member

Currently, once a toolbox container gets started with 'podman start', as part of the 'toolbox enter' command, it doesn't stop unless the host is shut down or someone explicitly calls 'podman stop'. This becomes annoying if someone tries to remove the container because commands like 'podman rm' and such don't work without the '--force' flag, even if all active 'toolbox enter' and 'toolbox run' sessions have terminated.

A crude form of reference counting has been set up that depends on 'podman stop' failing as long there's any active 'podman exec' session left. Every invocation of 'podman exec' in 'enter' and 'run' is followed by 'podman stop', so that the container gets stopped once the last session finishes.

While this approach looks very crude at first glance, it does have the advantage of being ridiculously simple to implement. Thus, it's a lot more robust and easier to verify than setting up some custom reference counting or synchronization using other means like POSIX signals or file locks.

Based on the implementation in github.com/coreos/toolbox.

#114

Currently, once a toolbox container gets started with 'podman start',
as part of the 'toolbox enter' command, it doesn't stop unless the
host is shut down or someone explicitly calls 'podman stop'. This
becomes annoying if someone tries to remove the container because
commands like 'podman rm' and such don't work without the '--force'
flag, even if all active 'toolbox enter' and 'toolbox run' sessions
have terminated.

A crude form of reference counting has been set up that depends on
'podman stop' failing as long there's any active 'podman exec' session
left.  Every invocation of 'podman exec' in 'enter' and 'run' is
followed by 'podman stop', so that the container gets stopped once the
last session finishes.

While this approach looks very crude at first glance, it does have the
advantage of being ridiculously simple to implement.  Thus, it's a lot
more robust and easier to verify than setting up some custom reference
counting or synchronization using other means like POSIX signals or file
locks.

Based on the implementation in github.com/coreos/toolbox.

containers#114
@softwarefactory-project-zuul
Copy link

Build failed.

✔️ unit-test SUCCESS in 10m 53s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 4m 27s
system-test-fedora-rawhide FAILURE in 26m 27s
system-test-fedora-36 FAILURE in 25m 57s
system-test-fedora-35 FAILURE in 14m 29s

@halfline
Copy link

I guess this is an alternative to #1207 ? If so, feel free to close #1207

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

Successfully merging this pull request may close these issues.

2 participants