VSCode Debugger scenarios to Attach to NestJS Application Running in Docker with Custom Network
I'm having a hard time understanding I've searched everywhere and can't find a clear answer... I've looked through the documentation and I'm still confused about I'm working on a personal project and I'm trying to debug a NestJS application running inside a Docker container, but the VSCode debugger isn't attaching properly. My setup involves a multi-container Docker environment, where the NestJS app is in one container and a Postgres database in another. I'm using the latest version of VSCode (1.70.0) and the official Docker extension. My launch configuration looks like this: ```json { "version": "0.2.0", "configurations": [ { "type": "node", "request": "attach", "name": "Attach to NestJS", "port": 9229, "restart": true, "timeout": 10000, "remoteRoot": "/usr/src/app", "localRoot": "${workspaceFolder}/src", "protocol": "inspector" } ] } ``` I start my NestJS application with the following command in the Dockerfile: ```dockerfile CMD [ "node", "--inspect=0.0.0.0:9229", "dist/main.js" ] ``` The application starts up without errors, but when I try to attach the debugger, I get the behavior message: ``` Unable to attach to the process. Make sure the application is running and the debugger port is correct. ``` I've verified that the port is exposed in my `docker-compose.yml` like this: ```yaml services: nestjs: build: . ports: - "9229:9229" networks: - my-network ``` I also checked that my containers are on the same Docker network, but it still seems to unexpected result. I've tried tweaking the `remoteRoot` and `localRoot` settings, but they don't seem to resolve the scenario. Is there something specific about configuring the debugger for a NestJS app running in Docker that I might be missing? Any insights would be really appreciated! For context: I'm using Javascript on Linux. What's the best practice here? For context: I'm using Javascript on Linux. How would you solve this? This is happening in both development and production on CentOS. How would you solve this? Has anyone else encountered this?