Taken from Docker's documentation that if you want to run a standalone NodeJS script you are supposed to use the following command:
docker run -it --rm --name my-running-script -v "$PWD":/usr/src/app -w /usr/src/app node:8 node your-daemon-or-script.js
This works except that it's not possible to stop the script using Ctrl-C. How can I achieve that?
Here is my script.js:
console.log('Started - now try to kill me...');
setTimeout(function () {
console.log('End of life.');
}, 10000);