[英]Remote debugging running process inside docker container
I'm running a node.js application inside a Docker
container. 我正在
Docker
容器中运行一个node.js应用程序。 I need to debug this application with Intellij Ultimate 15
. 我需要使用
Intellij Ultimate 15
调试此应用程序。
demoapp:
build: .
command: 'bash -c "npm install && npm run debug"'
ports:
- "8989:8989"
environment:
VIRTUAL_HOST: 'demoapp.docker'
VIRTUAL_PORT: 8989
The debug
script from package.json
package.json
的debug
脚本
"debug": "(node-inspector --web-port=8989 app.js &) && node --debug app.js"
And the configuration in the IDE 以及IDE中的配置
The IDE responds with a Frame is not available
. IDE响应时显示
Frame is not available
。 I guess it couldn't connect. 我猜它无法连接。
Am I doing something wrong? 难道我做错了什么?
Moreover, I'm able to debug using Chrome
. 此外,我可以使用
Chrome
进行调试。 If I visit the demoapp.docker:8989
it connects and I can start debugging. 如果我访问
demoapp.docker:8989
它将连接并且可以开始调试。
You should connect to the debug port via IntelliJ debugger, not to the web port. 您应该通过IntelliJ调试器连接到调试端口,而不是Web端口。 So you should specify it (with the
--debug
option) on the node runtime and expose it to the docker host and after that you'll be able to connect to it. 因此,您应该在节点运行时上指定它(使用
--debug
选项),并将其公开给docker主机,之后便可以连接到它。
More info in the JetBrains documentation: https://www.jetbrains.com/idea/help/running-and-debugging-node-js.html#remote_debugging JetBrains文档中的更多信息: https : //www.jetbrains.com/idea/help/running-and-debugging-node-js.html#remote_debugging
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.