在docker中使用pm2或forever

来源:互联网 发布:淘宝美工接私活价格 编辑:程序博客网 时间:2024/05/17 23:38

使用命令 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 // 设置启动方式

参考文档

  • https://github.com/Unitech/PM2/blob/master/ADVANCED_README.md
  • http://stackoverflow.com/questions/26237044/error-starting-node-with-forever-in-docker-container

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

http://blog.xinshangshangxin.com SHANG殇

0 0
原创粉丝点击