How attach Webstorm debugger to an already running node process on a docker container
Hi,
I have a multi-container application defined in a docker-compose file. One of this containers runs a node express application using the following command:
nodemon --inspect=5858 index.js
This container expose the ports 4500 for the server and 5858 for the node debugger.
I would like to attach the Webstorm debugger to this node process on the container, specifically on the port 5858. I've tried creating a remote node interpreter configuration specifying docker-compose and the related node service:

But when I run the debugger Webstorm tries to recreate the service, failing because it is already running. I would like just the debugger to attach to the running process. Is this possible?
Please sign in to leave a comment.
You need using Attach to Node.js/Chrome run configuration to attach to a running process. See https://www.jetbrains.com/help/webstorm/2019.3/running-and-debugging-node-js.html#node_debugging_running_application
Thank you!
One thing to add is that remote debugger will not be able to attach unless the inspect option has the following format:
node --inspect=0.0.0.0:PORT file.js
Without the 0.0.0.0 host part I was not able to attach.
Yes,
0.0.0.0is required as node binds to localhost by default and thus can't be accessed from outsideI have a very similar setup.
I have a multi-container application running in Docker and I am trying to attach a debugger. I am running
but I can't seem to attach to the debugger. I have an Attach to NodeJS/Chrome configuration that's bound to the inspection port and the file structure in the container is the same as that in the root project.
@Becky S What are you trying to debug - ng serve command, or your Angular application? In the latter case, you should have used the JavaScript Debug run configuration to attach the debugger to your page. See https://www.jetbrains.com/help/webstorm/2020.3/angular.html#angular_running_and_debugging