简体   繁体   中英

Remote debugging running process inside docker container

I'm running a node.js application inside a Docker container. I need to debug this application with 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

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

And the configuration in the IDE

在此处输入图片说明

The IDE responds with a Frame is not available . I guess it couldn't connect.

Am I doing something wrong?

Moreover, I'm able to debug using Chrome . If I visit the demoapp.docker:8989 it connects and I can start debugging.

You should connect to the debug port via IntelliJ debugger, not to the web port. 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.

More info in the JetBrains documentation: https://www.jetbrains.com/idea/help/running-and-debugging-node-js.html#remote_debugging

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM