【问题标题】:Remote debugging running process inside docker containerdocker容器内远程调试运行进程
【发布时间】:2016-04-06 16:30:08
【问题描述】:

我在 Docker 容器内运行 node.js 应用程序。我需要使用Intellij Ultimate 15 调试此应用程序。

demoapp:
  build: .
  command: 'bash -c "npm install && npm run debug"'
  ports:
    - "8989:8989"
  environment:
      VIRTUAL_HOST: 'demoapp.docker'
      VIRTUAL_PORT: 8989

来自package.jsondebug 脚本

"debug": "(node-inspector --web-port=8989  app.js &) && node --debug app.js"

以及IDE中的配置

IDE 以 Frame is not available 响应。估计连不上

我做错了吗?

此外,我可以使用Chrome 进行调试。如果我访问demoapp.docker:8989,它会连接,我可以开始调试。

【问题讨论】:

    标签: node.js intellij-idea docker remote-debugging docker-compose


    【解决方案1】:

    您应该通过 IntelliJ 调试器连接到调试端口,而不是 Web 端口。因此,您应该在节点运行时指定它(使用 --debug 选项)并将其公开给 docker 主机,然后您就可以连接到它。

    JetBrains 文档中的更多信息:https://www.jetbrains.com/idea/help/running-and-debugging-node-js.html#remote_debugging

    【讨论】:

      猜你喜欢
      • 2018-01-13
      • 2018-09-20
      • 2019-05-16
      • 2015-08-16
      • 2020-02-05
      • 2018-10-19
      • 2016-07-25
      • 1970-01-01
      • 2019-10-10
      相关资源
      最近更新 更多