-
Notifications
You must be signed in to change notification settings - Fork 514
Support handling SIGINT when running any "up" command #436
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
Comments
it is most annoying when pressing ctrl+c that I've got a container that is still spamming to the terminal |
Is there any workaround possible? |
@universam1 workaround? Sure. Just run: podman-compose down |
This would also be incredibly useful for systemd units. I'm struggling every time to make these systemd units resilient because With podman handling SIGTERM/SIGINT, it would be possible to use Just to illustrate what it could look like:
|
The current behavior of A temporary solution is, create #!/bin/bash
# Function to clean up containers on Ctrl+C
cleanup() {
echo "Cleaning up containers..."
podman-compose down
}
# Trap Ctrl+C and call the cleanup function
trap cleanup SIGINT
# Run podman-compose in the foreground
podman-compose up and use |
As someone moving from Docker + Docker Compose -> Podman + Podman Compose, this really caught me off guard. IMO this is a small UX feature that should really be replicated from Docker Compose. I'm not sure how representative my workflow is, but it's a constant stream of |
Upon closer inspection, it looks like perhaps SIGINT is expected to work: podman-compose/podman_compose.py Lines 2283 to 2303 in d704622
Is there some weird interaction with the scoping of |
simple workaround for me to stop running containers on crtl+c |
It should be trapped the same way docker-compose does:
When
up
command was invoked and podman-compose process receives SIGINT (e.g. from keyboard by Ctrl+C'ing) it should trap this signal and bring all containers down in a controlled manner and then end itself as decribed here:I am open for discussion, whether this makes sense or not but it can be considered a usability feature for developers using the shell builtin keyboard shortcuts (or any other means) to send signals to a process (the Ctrl+C'ing is my usecase basically)
The text was updated successfully, but these errors were encountered: