Skip to content
This repository has been archived by the owner on Feb 10, 2025. It is now read-only.

standalone mode in docker can't be killed by SIGTERM #474

Closed
1 task done
zfben opened this issue Dec 6, 2024 · 2 comments
Closed
1 task done

standalone mode in docker can't be killed by SIGTERM #474

zfben opened this issue Dec 6, 2024 · 2 comments

Comments

@zfben
Copy link

zfben commented Dec 6, 2024

Astro Info

the docker image based on node:lts-alpine

Describe the Bug

  1. build a docker image
  2. start it
  3. stop it by docker kill --signal=SIGTERM

the server doesn't stop.

What's the expected result?

stop the server and container.

Link to Minimal Reproducible Example

https://idx.google.com/just-the-basics-5506607

Participation

  • I am willing to submit a pull request for this issue.
@kaytwo
Copy link

kaytwo commented Dec 29, 2024

Your idx gave me an auth error, but I ran into the same problem, here's what I learned:

  • I had this issue with the dev server as well, however switching to this command in my compose file fixed it: command: sh -c "npm install && exec npm run dev" - this causes sh to not eat the SIGINT and shut down cleanly.
  • I was able to reproduce this and tried both the "exec style" and "shell style" invocations in my Dockerfile, however both seemed to ignore SIGTERM.
  • They don't, however, ignore SIGINT, so setting STOPSIGNAL SIGINT in the Dockerfile "fixed" the problem for me.

I don't know whether there is anything in the innards of the node server that will break because we're sending SIGINT instead of SIGTERM, but I doubt it.

@zfben
Copy link
Author

zfben commented Dec 29, 2024

@kaytwo I switch to middleware mode and handle signal manully now. maybe you can do it too.

@ematipico ematipico closed this as not planned Won't fix, can't repro, duplicate, stale Feb 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants