BretFisher / node-docker-good-defaults

sample node app for Docker examples
MIT License
2.34k stars 486 forks source link

About vscode debugging #62

Open CeccoCQ opened 5 years ago

CeccoCQ commented 5 years ago

Maybe I'm too newbie with Vscode, but I don't understand at all how can I debug this nodejs app in a total way.

If I would to start the docker container with docker-compose up then try to debug www file, for example, I'm not able to do it. So, I've some questions:

Schermata 2019-08-08 alle 09 10 41
BretFisher commented 5 years ago

Did you figure this out? I didn't have time lately to look into this.

BretFisher commented 5 years ago

Some quick answers without testing:

  1. --inspect is on by default in the docker-compose.yml. I guess you're asking about VS Code turning on debugging by default, and I'm not sure.
  2. That sounds right. Node is stopped and restarted, so VS Code may not auto-reconnect to inspector port. There might be a VS Code setting to do that.
  3. Not sure exactly. VS Code can be tricky in the launch.json settings sometimes. Note that healthcheck.js isn't running by the same process that's running that app, so it won't be debuggable by VS Code using the existing launch.json. It's run by the Dockerfile HEALTHCHECK command which runs a separate node process via docker exec. To debug that, you'd need to enable --inspect option in that HEALTHCHECK command, but the exec won't publish the ports, so debugging it would require a more creative solution.
outbits commented 3 years ago

Hello,