-
-
Notifications
You must be signed in to change notification settings - Fork 17k
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
When running examples in docker - can't kill'em using CTRL+C #3667
Comments
This is an issue starting processes in Linux as PID 1. You'll run into this issue all over. The correct solution is to actually run your docker image so ctrl c works as expected instead of every program changing. Include |
...that would be So all in all: docker run -it --rm -p 3000:3000 --pid host -v $(pwd):/app:rw -w /app node:10 node examples/mvc/ Does exactly what I want. Thanks @dougwilson I absolutely agree that this is the right approach. |
Glad it worked for you. I have always had the equal sign there and Docker's own documentation shows using the equal sign. Not sure why it doesn't work for you. You may want to get Docker to fix their docs at the very least. From https://docs.docker.com/engine/reference/run/
|
It's not the equal sign, that's just preference in style. It's the The switch is Just clarifying the spelling mistake that snug in. All is good. Thanks! |
Oooh, sorry! Since you didn't say what you changed and you changed more than one thing and I was only expecting one change, I was just assuming the one change you made was the first one that caught my eye. |
I'm running
node
andnpm
from a docker container - without actually installing the tools locally. The following works fine:(now browse to port 3000 on your docker host IP)
However, as discussed in node/issues#4182 hitting
<CTRL>+C
doesn't stop the process running in the docker host, the docker host receives it and passes it on (that's what the-i
+-t
switches todocker run
does) but the express server ignores it.Consequently the behaviour is different from running the same example with a native
node
installation:Adding the following snippet to (in this example to
expressjs/examples/mvc/index.js
solves the issue:The text was updated successfully, but these errors were encountered: