-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Discussion] Node.js in Docker for production #161
Comments
Hi @fwirtz, Have you checked out the Node.js Docker Best Practices - the link is kind of hidden in the Docker guide. |
Hi @Starefossen, you are right, there are some more Tips that I have not taken into account |
I had also a hard time finding good tips on workflow and production recommendations. Some good ones I found:
Some interesting stuff: http://jdlm.info/articles/2016/03/06/lessons-building-node-app-docker.html (very good) |
Wow. Thats awesome. Thank you very very much. I didnt have time to read all |
Great list @davidbnk! 👍 Feel free to propose a PR to the Node.js Docker Best Practices guide. |
@fwirtz No problem! |
@davidbnk Wow david, that list and the articles really are awesome - THANK YOU!!! |
"might use node index.js over npm start (Thanks @pesho src )" |
If your application launches through a shell script, or spawns children via In addition to all that, this is a good time to make sure that your application intercepts and handles SIGTERM correctly, and calls (On that note, it's also worth remembering that, by default, docker only waits 5 seconds for the process to exit after sending SIGTERM before it sends SIGKILL. This is a very short amount of time, which can be a problem for applications that require more time to exit cleanly.) |
Hi, I tested node14+npm6 & node16+npm 8 I found that npm does NOT swallow SIGTERM signal as many articles said, including Node.js Docker Best Practices guide. I am also confused with the Pid 1 problem stated in the guide. I asked my question at SO The problem with npm start to start the node app in docker but no answer yet. So can someone (maybe @Starefossen ) cast some light on it ? Thanks! |
I found this closed issue lifecycle: propagate SIGTERM to child So npm did fix it but the latest comment (2017) in that said "Yes, this isn’t working, at least with bash; npm runs its lifecycle processes in a shell, and bash doesn’t forward SIGTERM to its children." But that was 5 years ago! |
Fixed in [email protected] npm/cli#6684 |
So, in the official guide it states that the Dockerfile is not ment for production, however there is just very little information on what a production environment whould actually look like.
I am curious now and really want to create a list of differences in here.
So far I've got the following:
A production environment
But what else really would there be?
This Issue is more of a discussion, evolved from PR666 and is mostly aimed at @nodejs/docker
The text was updated successfully, but these errors were encountered: