I want to debug a node server. I open chorme://inspect, open the dedicated dev tool for node, run node --inspect dockerme.js, and everything works.

Now I want to debug the server from within its docker container. I run the following:

$ sudo docker run -p 8081:8081 -p 9229:9229 localhost:5000/dockerme \
node --inspect dockerme.js
$ sudo docker ps
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS              PORTS                                            NAMES
730bb9144858        localhost:5000/dockerme   "node --inspect dock…"   3 minutes ago       Up 3 minutes>8081/tcp,>9229/tcp   modest_fermi
12853a05c4d0        registry:2                "/entrypoint.sh /etc…"   4 weeks ago         Up 46 hours>5000/tcp                           registry

The server still works, but I can't debug it. Why?


FROM node:8
COPY . /app
RUN npm install
CMD ["node", "dockerme.js"]

How can I debug a node server from a docker image I can't change?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.