-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Graceful shutdown of Docker container not respected #2152
Comments
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. |
My guess is that the sub process isn't shutting down when you send the ctrl+c (which is received by nodemon) so nodemon has a grace period (of 10 seconds polling the sub process) after which it forcibly exits. Wonder if running your docker instance with env value |
@remy here's the debug output you suggested:
I've updated the reproduction repo to include the I don't know if this output is useful because nothing actually gets logged after pressing Ctrl + C (the line beginning with |
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. |
@remy I don't think this issue should be closed. I can still reproduce this, even in both Rancher Desktop:
…and OrbStack:
|
I'm seeing the same behavior in a standard docker compose setup at the moment. I've also been able to reproduce the issue with @hdodov's mcve repository and tried adapting it to run a minimal express app that also listens for SIGINT and SIGTERM signals during runtime, neither of which seem to reach the application. |
As I posted on Stack Overflow:
My project uses nodemon inside Docker. It runs perfectly, but when I stop the process from my terminal with Ctrl+C, the container doesn't get turned off immediately. Instead, I have to wait for exactly 10 seconds before Docker finally kills it.
My guess is that nodemon fails to trap the SIGINT signal and doesn't act on it.
nodemon -v
: 3.0.2nodemon src/script.js
Expected behaviour
Docker container should immediately exit.
Actual behaviour
Docker container exits after a 10 second delay.
Steps to reproduce
I've made a GitHub repo with the example. Reproduction steps are in the README.
If applicable, please append the
--dump
flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.The text was updated successfully, but these errors were encountered: