- Debug mode
Run the node process in debug mode
set the npm start script to start in debug mode. This will send debugging information to port 5858 by default.
scripts": {
"start": "node --debug ."
}
- Expose the port in the docker-compose file
This allows the debugger running outside of docker to connect the port 5858
- Add a launch configuration
{
"name": "Docker: Attach to Node",
"type": "node",
"request": "attach",
"port": 5858,
"protocol": "legacy",
"localRoot": "${workspaceFolder}",
"remoteRoot": "/usr/src/app"
}
- Restart
docker-compose restart <service>
"debug"
script in thepackage.json
of portal-api for an example of how to set this updocker-compose up <service>