Docker Community Forums

Share and learn in the Docker community.

Error starting node with forever in docker container

(Hellb0y77) #1

I have a problem when start node with forever in docker container, if i launch manually works, instead the same command in Dockerfile, when build and start the container, exited. The command works in bash:

forever start -c ‘node --harmony’ /my/path/app.js

I tried to put command in Dockerfile but the container don’t start

CMD forever start -c ‘node --harmony’ /my/path/app.js

I have tried also with:

CMD [“forever”,“start”,"-c","‘node --harmony’","/my/path/app.js"]


CMD [“forever”,“start”,"-c",“node --harmony”,"/my/path/app.js"]

But don’t work, any idea?

(Sven Dowideit) #2

Sorry, I havn’t gotten to this (on google groups either) as the information you’ve provided isn’t enough to me to quickly duplicate it.

If you post your entire Dockerfile and source, or a simplified version of your code / similar, then someone might get there faster :smile:

(Diogo Monteiro) #3

Forever starts the node app in the background. If no processes are active running in the foreground the container will exit.
Please refer to this stack overflow thread for more details:

(Diogo Monteiro) #4

Try something like this:
CMD [“forever”, “-c”,“node --harmony”,"/my/path/app.js"]