How to debug Theia running in a Docker container?

Hello. We are observing some strange behavior when running our Theia app in a Docker container on a specific Linux Docker host only. Therefore, I would like to debug the Theia Node backend remotely, but I am stuck already getting it to work locally on my Mac. Anybody has any experience and tips? Do I have to do something with the hostname?

Here is what I did:

  • I built a special version of a Theia Docker image that keeps all the source code (which allows me to debug the browser code as well)

  • I start Theia with this command: docker run -it -p 3000:3000 --expose 9229 -p 9229:9229 06cea55c9115 --log-level=debug --inspect=

  • In the Theia terminal I can see with ps that node is running like this then: node /home/wazi/src-gen/backend/main.js /home/project --hostname= --log-level=debug --inspect=

  • On my Mac I created a VS Code launch like this:

      "name": "Attach to Docker Theia Backend",
      "type": "node",
      "request": "attach",
      "port": 9229,
      "address": "",
      "localRoot": "${workspaceFolder}",
      "remoteRoot": "/home/wazi/src-gen/backend/main.js",
      "protocol": "inspector"
  • When I try to launch this I just get timeouts

Thanks in advance for any tips,

[original thread by Peter Haumer]

Could you post output from Node.js? Can you connect to given ws endpoint via browser?

I had issues with some Node.js version which won’t allow connecting me remotely.

[Peter Haumer]

Thanks. Do you mean via chrome://inspect/#devices? I do not see anything listed there either. I also do not see any helful output. I solved my problem without it now. Perhaps I try this again when we switched to Node 10.

I meant when you start node.js process in inspect mode it should give you an address of an endpoint to debug. It should be possible to open it in Chrome for debugging.

like here

if it does not work then you can debug Chrome Dev Tools itself (just open it again) and see why it cannot connect