Created the simplest container with NodeJS and Express.
package.json:
{ "name": "Test", "version": "0.0.1", "main": "server.js", "scripts": { "start": "forever -w server.js" }, "dependencies": { "express": "~4.15.3", "mongoose": "~4.10.7", "body-parser": "~1.17.2", "forever": "~0.15.3" } } As you can see, I set forever.js so that file changes are picked up automatically. It works perfectly on the host system. Next, I launch the docker container by flashing the folder from the host system into it:
docker run -p 49160:8080 -d -vc:/calendar/code/server:/usr/src/app kamplyktar/test I get here such a log, like nothing critical:
npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.11.0 npm info lifecycle Calendar@0.0.1~prestart: Calendar@0.0.1 npm info lifecycle Calendar@0.0.1~start: Calendar@0.0.1 > Calendar@0.0.1 start /usr/src/app > forever -w server.js warn: --minUptime not set. Defaulting to: 1000ms warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms error: Could not read .foreverignore file. error: ENOENT: no such file or directory, open '/usr/src/app/.foreverignore' Running on http://localhost:8080 But when changing server.js on the host system, I do not see any changes at http: // localhost: 49160 /
Those. the feeling that forever.js is not working does not restart the server. What could be the problem?