Node.js inspecting through Docker and Docker compose on a remote host

Running my Docker (Compose) setup on AWS, behind an Application Loadbalancer I stumbled upon the case that I needed to find a memory leak. Thus I needed to connect Chrome to it.

This is what I needed to do to get it working;

In the docker-compose.yml I needed to expose port 9229 next to the http port already exposed, like;

  - "80:8888"
  - "9229:9229"

Now, I also needed to use the --inspect option to start the application with, but behold, using this way:

node --inspect= ./bin/www

Why? This Stack Overflow item explains. (The node.js docs are helpful too.)

Ok. Almost there. The only thing left for me to do is also forward port 9229 to my local machine to have the service available.

Although the (web)application runs behind a load balancer I do connect to it directly using a security group that has port 9229 open.

Boyaa! 🎉 Let the journey begin...