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

Teardown command? #472

Open
FezVrasta opened this issue Apr 25, 2024 · 2 comments
Open

Teardown command? #472

FezVrasta opened this issue Apr 25, 2024 · 2 comments

Comments

@FezVrasta
Copy link

I'm trying to run a docker container along with a node.js server, and I would like to stop the container when the user stops the node.js server script.

"dev": "concurrently 'node server.js' 'docker start -i database'"

Unfortunately Docker doesn't properly shuts down the container when CTRL+C is pressed, even though it does it when I run the docker command directly.

Would it be possible to add a --teardown option that allows to specify a script to run when the process is interrupted (CTRL+C is pressed)?

"dev": "concurrently --teardown 'docker kill database' 'node server.js' 'docker start -i database'"
@gustavohenke
Copy link
Member

gustavohenke commented Apr 25, 2024

Hey, thanks for the report.
I'm interested in this bit:

Docker doesn't properly shuts down the container when CTRL+C is pressed, even though it does it when I run the docker command directly.

Does it stop the container when you press ctrl+c?
If yes - I think it's probably best if we fixed concurrently, instead of adding another option.

Testing with a mysql image, it ignores every ctrl+c when in interactive mode.

@FezVrasta
Copy link
Author

FezVrasta commented Apr 25, 2024

CleanShot 2024-04-25 at 2  43 57@2x

I see the container is properly shut down on CTRL+C on macOS. I'm using the postgres image though.

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