-
Notifications
You must be signed in to change notification settings - Fork 2.6k
PM2-docker fails to intercept docker stop signal #2502
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
Thanks for this great bug report. After testing your example, I found that pm2-docker was only listening to the SIGINT signal (explaining why the graceful stop was working with CTRL-C). Whereas The event has been added to the pm2-docker on the dev branch. To try it:
|
That's excellent. Thanks for the quick response. I can also confirm the development branch is intercepting the SIGTERM as expected. The dev install will suit my use case (which is currently pre-prod) until this commit makes it into a release. |
Thanks for testing. Any feedback about pm2-docker is warmly welcome. |
published on [email protected] |
Expected behaviour
When stopping a container running pm2, with the
docker stop
command, I expect PM2 to intercept the signal and pass this to the node process.Actual behaviour
The signal is not intercepted. The
docker stop
command hangs for 10 seconds (which is the default time), before sending a kill signal.Steps to reproduce
index.js
Dockerfile
docker build -t sigterm-image .
docker run --name sigterm sigterm-image
docker stop sigterm
Interestingly if the running container is interrupted from the terminal with Ctrl-C, PM2-Docker intercepts the signal as expected, like so:
I have also uploaded the image publicly on Docker Hub as
abxit/pm2-docker-interrupt-test
for ease of testing.Software versions used
The text was updated successfully, but these errors were encountered: