I have used vs docker extension to create docker files. But I don't know what is the "proper" way to use docker-compose.debug.yml to debug my code, e.g. how do I set my env. so I can just hit F5 and all the magic happen.
I did work out a way to debug my code. First run docker-compose -f docker-compose.debug.yml
in terminal. Then use the launch.json from In-container Node Development: Visual Studio Code to attach to my node in docker.
But I think Code may provide a simpler way to streamline the debug process.
I had the same issue. Using
--inspect=0.0.0.0:9229
solved it. I recommend you use--inspect-brk
too, to have the node process wait for the debugger to attach.You can do that but through some modifications.
launch.json
As you can see I commented the local launch and made this the first one so it is run on F5. Next we need to define a
start_node_compose
tasktasks.json
Then when you run the command using F5 you will be able to hit the breakpoint