Debugging Docker containers

Sometimes, you have code running in a container that is not working. In that case, it's useful to be able to debug the application as it's running inside of the container. VS Code provides the correct Docker configuration to do this.

  • Build the container with the "debug.docker-compose.yml" file

  • Add a launch configuration for Docker

  • Attach the debugger to the running container

  • Set a breakpoint in the "routes/index.js" file

  • Visit the app in the browser, change the color and click the button

  • See the debugger break at the breakpoint

Last updated