Breakpoint set but not yet bound in Visual Studio Code for a dockerized node process

I am trying to use the debugger in Visual Studio Code on a macOS Catalina for a node app. I created a very simple example to illustrate my case.


require('http').createServer( (request, response) => {
  response.writeHead(200, {'Content-Type': 'text/plain'})
  response.end('Hello Worldn');


FROM node:12.14.0-alpine 
COPY . /src
CMD ["node","--inspect=", "src/index.js"]

I build the Dockerfile

docker build . -t debugtest

and then run it

 docker run -p 3000:3000 -p 9229:9229 debugtest

I can access http://localhost:3000/.

I set a breakpoint in index.js.

enter image description here
Then setup a debugger target in visual studio code

  "version": "0.2.0",
  "configurations": [
    "type": "node",
    "request": "attach",
    "name": "Attach",
    "port": 9229,
    "skipFiles": [

Now when I start the debugger in visual code the red dot of the breakpoint disappears and “Breakpoint set but not yet bound” appears.

enter image description here

I have seen that question in various spots but none of the solutions worked. When I run the node process outside of docker node --inspect index.js it works without a hitch.

I am using version 1.41.1 of visual studio code and docker

Source: StackOverflow