When debugging a Node.js application, I expect the command node index.js --inspect=5858 to make my index.js file debuggable on the port 5858.
When I run the application outside of Docker, on my host computer, I'm able to debug the application in Chrome Dev Tools. I did the same inside of Docker and Chrome Dev Tools is unable to access the debugger on port 5858.
As you can see, port 5858 is exposed to the host computer for debugging:
version: '2'
services:
server:
build: .
command: node index.js --inspect=5858
volumes:
- .:/app
ports:
- "8000:8000"
- "5858:5858"
environment:
- NODE_ENV = "development"
I've specified localhost:5858 and 127.0.0.1:5858 network endpoints in Chrome Dev Tools, though still Dev Tools does not connect to it automatically as it suggests.
This seems to be an issue with my Docker setup though as you can see, I have exposed the port to the host computer. What could be the issue? Thanks.
docker exec -it container_id shnetstat -tulpnand port 5858 is running with program name45/nodeso it is running