使用命令 pm2 start app.js 之后, pm2 默认在后台运行,
如果使用了docker后,容器运行并立即退出,需要手动指定参数--no-daemon

--no-daemon                          
// run pm2 daemon in the foreground if it doesn't exist already
pm2 start app.js --no-daemon // 设置启动方式

同理forever也是
Forever start script.js runs in the background. To run forever in the foreground, try forever script.js.

forever -c 'node --harmony' app.js // 设置启动方式

参考文档


文章若有纰漏请大家补充指正,谢谢~~

http://blog.xinshangshangxin.com SHANG殇

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐