Question:
We’re using node v18.3.0I’m starting my nestjs app, inside a docker container, with this command
nest start -e \"node --inspect-brk\"
. Which gives the following output:I have forwarded port 9229 on the docker container,
docker ps
:telnet localhost 9229
:
But there’s no error log or anything so I have no idea how to fix this. Any help is greatly appreciated!
Answer:
For debugging a NodeJS application running a docker127.0.0.1
interface wont reach the docker network try using 0.0.0.0
.In the debug command at the package json change it to
nest start -e \"node --inspect-brk=0.0.0.0:9229\"
The
0.0.0.0
will tell the debugger to look at all available local network interfaces.In the vscode debug configuration
"address": "0.0.0.0"
and it is recommended to use "remoteRoot"
and "localRoot"
directives for syncing the position of the current vscode work directory files to the files in the docker file system.If you have better answer, please add a comment about this, thank you!