NodeJS + Forever + Docker configuration doesn't work NodeJS + Forever + Docker configuration doesn't work docker docker

NodeJS + Forever + Docker configuration doesn't work


Docker exits as soon as the given command is finished. forever start SCRIPT is starting the script as a daemon in the background, and then exiting. That's why your container stops.

To make it work, you should start forever in the foreground by using forever SCRIPT. The CMD in your Dockerfile should be:

CMD ["forever", "/api/index.js", "8080"]