Debugger - Docker and NodeJS
Remote Debugging with Docker and Node.js
-
Update
docker-compose.ymlto enable debugging:version: '3.7' services: chips: build: . command: node --inspect=0.0.0.0:9229 server.js -
Start the application with debugging enabled:
student@oswe:~/chips$ docker-compose up -
Configure
launch.jsonfor Node.js debugging in Visual Studio Code:{ "version": "0.2.0", "configurations": [ { "type": "node", "request": "attach", "name": "Attach to remote", "address": "chips", "port": 9229, "localRoot": "${workspaceFolder}", "remoteRoot": "/usr/src/app" } ] } -
Start the debugging session in Visual Studio Code:
- Open the debug panel and select the configuration.
- Set breakpoints and step through the code as needed .