Error starting node with forever in docker container

后端 未结 4 925
孤城傲影
孤城傲影 2020-12-28 18:03

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, ex

相关标签:
4条回答
  • 2020-12-28 18:06

    I'm now trying to use forever in docker. This works:

    CMD ["forever", "src/app.js"]
    
    0 讨论(0)
  • 2020-12-28 18:12

    Google Group discussion

    Forever start script.js runs in the background. To run forever in the foreground, try forever script.js.

    This starts forever in the foreground, which is what Docker needs. Remember a container is "alive" only as long as the process defined in CMD is up and running. Since forever starts as a daemon, the command itself exits and docker will exit also.

    CMD forever -c 'node --harmony' /my/path/app.js
    
    0 讨论(0)
  • 2020-12-28 18:14

    Try using the array syntax:

    CMD ["forever", "start", "-c", "node --harmony", "/my/path/app.js"]
    
    0 讨论(0)
  • 2020-12-28 18:26

    Put in your Dockerfile :

    CMD forever app.js
    
    0 讨论(0)
提交回复
热议问题