【问题标题】:Trying to start pm2-runtime with 3 instances for a MEAN application尝试使用 MEAN 应用程序的 3 个实例启动 pm2-runtime
【发布时间】:2018-12-21 07:45:13
【问题描述】:

我正在尝试使用以下 Docker 命令在 Docker 容器中启动现有的 MEAN 堆栈应用程序:

CMD ["pm2-runtime", "-i", "3", "npm", "--", "run-script", "start:prod"]

该命令确实启动了 3 个 PM2 实例,但是 npm 部分似乎没有运行 run-script 部分,并且在每个实例中都挂起并显示以下消息:

Usage: npm <command>
where <command> is one of:
    access, adduser, bin, bugs, c, cache, completion, config,
    ddp, dedupe, deprecate, dist-tag, docs, edit, explore, get,
    help, help-search, i, init, install, install-test, it, link,
    list, ln, login, logout, ls, outdated, owner, pack, ping,
    prefix, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, tag, team, test, tst, un, uninstall,

如果我删除 "-i", "3" 部分,它会以“fork”模式正确启动应用程序的 1 个实例。

考虑到将 NPM 与运行脚本一起使用,任何人都知道启动 3 个实例的正确语法是什么?

谢谢

【问题讨论】:

    标签: node.js docker docker-compose pm2 docker-command


    【解决方案1】:

    --bash 特有的功能,表示命令行选项的结束。

    但是,您没有运行bash,而是调用pm2-runtime 二进制文件并将参数传递给它。

    因此它本质上等同于以-- 作为命令调用npm。

    我认为-- 可以删除,它应该可以工作。

    【讨论】:

    • 删除 -- 遗憾的是没有任何区别。
    猜你喜欢
    • 2017-10-07
    • 2018-12-20
    • 1970-01-01
    • 2021-07-04
    • 2016-10-11
    • 1970-01-01
    • 2020-10-15
    • 2016-12-10
    • 1970-01-01
    相关资源
    最近更新 更多