Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

WebStorm Docker Integration

Erik Roberts edited this page Jan 25, 2023 · 10 revisions

Deprecation Notice

This document was written before NestJS integration, and no longer applies to newer versions of the API. You may continue to read it for now, however this article will be removed in the future.


It is possible to use WebStorm to develop Glimpse without any additional work beyond that in the README.md, however you can take steps to better integrate the project into your IDE, allowing you to use tools such as the built-in IDE debugger.

You should read the articles linked below for basic instructions on how to set up Docker in WebStorm. You can use Docker / Docker Compose run configurations to boot your Docker containers, however they will be booted completely detached from the IDE's debugger. To attach them, you have two options.

Method 1: "Attach to Node.js/Chrome" (Recommended)

WebStorm offers the ability to attach to a remote debugger, provided a host, port, and protocol. By default, the development Docker Compose config will run npm run dev.debug, which exposes the debugger socket in the Docker container at 0.0.0.0:5858. In your run configurations, add a new "Attach to Node.js/Chrome" configuration. Specify the host as localhost, port as 5858 and select Chrome or Node.js > 6.8 started with --inspect for the "Attach to" protocol. Make sure to check the box "Reconnect automatically", or else the debugger will not restart with Nodemon.

When you're ready to debug, you can select this new run configuration from the dropdown and click the bug icon to run it in debug mode. It will automatically attach to the Node debug socket.

Method 2: Node.js Remote Interpreter (Backup)

The previous method is preferred, but it might not work all the time. In this case, there is an alternative, but it is more work. You can set up a separate Node.js run configuration with a remote interpreter in the Docker container. This method could result in inconsistencies with what you see in the Docker Compose config due to how the file system works.

The program will execute within the Docker container, however it will essentially use the file system of the host machine. As a result, you will need to make sure your node_modules folder is populated. If your host machine is a different OS/arch than the Docker container (e.g. Windows), you may need to boot up the container using the CLI and copy the node_modules folder to the host first. Otherwise, you can probably just run npm install. Once you've populated the node_modules folder, if you want nodemon to auto-restart the program on file changes, you will need to add this line to the Node parameters of the run configuration: ./node_modules/.bin/nodemon -L --inspect=0.0.0.0:5858.

Sample Run Configurations

Read More

Clone this wiki locally