# Node.js with Docker

> **TL;DR**
> Required plugins:
>
>
>
> `JavaScript and TypeScript` -    the plugin is bundled with IntelliJ IDEA and enabled by default.
>
>
>
> `Node.js`, `Node.js Remote Interpreter`, `JavaScript Debugger`, `Docker` -    install the plugins on the Settings | Plugins page, tab Marketplace.     The plugins are available only in IntelliJ IDEA with the Ultimate subscription.

With Docker, you can quickly bootstrap your Node.js application to run, debug, and profile it from IntelliJ IDEA. The IDE will take care of the initial configuration by automatically creating a new `Dockerfile`, building and running an image, syncing your source code, and installing npm dependencies in the container.

You can find some examples at [Quick Tour of WebStorm
and Docker.](https://blog.jetbrains.com/webstorm/2017/04/quick-tour-of-webstorm-and-docker/)

## Before you start

Procedure:

1. Make sure the JavaScript and TypeScript and Docker required plugins are enabled on the Settings | Plugins page, tab Installed. For more information, refer to [Managing plugins](managing-plugins.html).

2. Install the Node.js, Node.js Remote Interpreter, and JavaScript Debugger plugins on the Settings | Plugins page, tab Marketplace, as described in [Installing plugins from
JetBrains Marketplace](managing-plugins.html#install_plugin_from_repo).     The plugins are available only in IntelliJ IDEA with the Ultimate subscription.

3. Download, install, and configure Docker as described in [Docker](docker.html).

## Configure a Node.js runtime in Docker

Node.js runtimes in Docker are configured in the Configure Node.js Remote Runtime dialog. You can open this dialog from the [JavaScript Runtime](javascript-runtime.html) page of the Settings dialog or later,  when you [create or edit a Node.js
run/debug configuration](#ws_node_docker_create_run_debug_configuration) for running or debugging your application in Docker.

The recommended way is to configure a remote Node.js runtime in the Settings dialog. In this case you can set the runtime and the associated package manager as default for your project.   As a result, you can not only run and debug your app with configured Node.js runtime in Docker but also manage your project dependencies, run tests, and lint your code.  See [npm, pnpm, and yarn with Docker](#ws_node_docker_manage_dependencies), [Test your application](#ws_node_docker_test_app), and [ESLint with Docker](#ws_node_docker_lint) below.

A remote Node.js runtime that you configure right in the Node.js run/debug configuration can be used only with this run/debug configuration.

Procedure: Create a remote Node.js runtime

1. Open the Settings dialog (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))) and go to `Languages & Frameworks | JavaScript Runtime`.

2. Click ![the Browse button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.general.ellipsis.svg) next to the Node runtime field.

![Add runtime - Browse button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_interpreter_from_settings_browse_button.png)

3. In the [Node.js Runtimes](node-js-interpreters.html) dialog with a list of all the currently configured runtimes, click ![the Add button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg) on the toolbar and select  Add Remote from the context menu .

![Configure Node.js runtime in Docker container: Add Remote](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_interpreter_from_settings_docker_add_remote.png)

4. In the [Configure Node.js Remote
Runtime dialog](configure-node-js-remote-interpreter.html) that opens, select Docker.

5. From the Server list, select the Docker configuration to use.

![Configure Node.js runtime in a Docker container: select Docker server](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_interpreter_from_settings_docker_select_server.png)

Alternatively, click New next to the field and configure a Docker server as described in [Enable Docker support](docker.html#connect_to_docker).

6. From the Image name list, select the image to use.

![Configure Node.js runtime in a Docker container: select Docker image](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_interpreter_from_settings_docker_select_image.png)

The Node.js executable is detected automatically and is shown in the Node.js runtime path field.

7. Click OK to return to the Node.js Runtimes dialog where the new runtime is added to the list.

![Remote runtimes dialog: the new Node.js runtime in Docker added to the list](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_node_configure_interpreter_run_configuration_remote_interpreters_dialog_docker_node_added.png)

8. To set the newly configured runtime as the project default, select it in the list and click OK to return to the JavaScript Runtime dialog.

![Settings: newly configured remote Node.js runtime selected as default](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_interpreter_from_settings_docker_default_project_interpreter_and_package_manager_detected.png)

IntelliJ IDEA automatically uses this interpreter every time you select the `Project` alias from Node runtime lists, for example, when creating run/debug configurations.

To use the package manager associated with the new runtime for managing your project dependencies, set this package manager as default in your project. To do that, specify the location of the package manager in the Package manager field.  Learn more from [Specify the default project Node.js runtime and package manager](#ws_node_docker_specify_default_project_interpreter_and_package_manager).

### Specify the default project Node.js runtime and package manager

IntelliJ IDEA automatically uses the default project interpreter every time you select the `Project` alias from Node runtime lists, for example, when creating run/debug configurations.

The default project package manager is used automatically for managing dependencies, for example, when you run `<package manager> install` from a `package.json` file or install third-party tools, such as ESLint, Prettier, and so on.

Procedure:

1. Open the Settings dialog (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))) and go to `Languages & Frameworks | JavaScript Runtime`.

2. From the Node runtime list, select the configuration to use by default in the current project.

3. From the Package manager list, select the alias associated with the package manager to use. IntelliJ IDEA detects its location automatically.

![Settings: newly configured remote Node.js runtime selected as default](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_interpreter_from_settings_docker_default_project_interpreter_and_package_manager_detected.png)

Alternatively, specify the location of the required package manager manually.

* The default location for npm executable is `/usr/local/lib/node_modules/npm`.

* The default location for pnpm depends on the installation method: 1. `/usr/local/lib/node_modules/pnpm` for installation through npm. 2. `/usr/local/pnpm-global/<version>/node_modules/pnpm` for installation through curl (`curl -f https://get.pnpm.io/<version>.js | node - add --global pnpm`). Learn more from the [pnpm official website](https://pnpm.io/installation).

* The default location for yarn is `/opt/yarn-<version>5`, for example, `/opt/yarn-v1.22.5`.

![Configure Node.js runtime in Docker container: set as default project interpreter](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_interpreter_from_settings_docker_default_project_interpreter_and_package_manager.png)

### npm, pnpm, and yarn with Docker

With IntelliJ IDEA, you can manage project dependencies and run scripts in a Docker container just in the same way as you do with local projects.

Procedure:

1. Make sure you have configured a [remote Node.js runtime in
Docker](#ws_node_docker_configure_interpreter).

2. [Specify the default project Node.js runtime and package manager](#ws_node_docker_specify_default_project_interpreter_and_package_manager)

3. Manage your project dependencies.

* Open your `package.json` file and proceed as with local development, for example, select Run '<package manager> install' from the context menu. The dependencies are installed using the default package manager inside the Docker container and the `node_modules` folder appears in your project.

* Alternatively, open your command-line shell or the embedded Terminal (`Alt+F12` (Windows), `⌥ F12` (macOS), `⌥ F12` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ T` (macOS System Shortcuts), `Alt+F12` (XWin), `Alt+F12` (GNOME), `Alt+F12` (KDE), `Alt+F12` (Emacs), `Alt+F12` (Sublime Text), `⌥ F12` (Sublime Text (macOS)), `Alt+F12` (NetBeans), `Ctrl+Alt+1` (Visual Studio), `⌘ ⌃ 1` (Visual Studio (macOS)), `Alt+F12` (Eclipse), `⌥ F12` (Eclipse (macOS))) and install the packages you need manually, for example, run `npm install --save-dev eslint`.

Learn more from [Install and update packages](installing-and-removing-external-software-using-node-package-manager.html#ws_installing_and_upgrading_packages) and [Edit package.json](installing-and-removing-external-software-using-node-package-manager.html#ws_npm_yarn_edit_package_json).

4. [Run scripts](installing-and-removing-external-software-using-node-package-manager.html#ws_npm_running_npm_scripts)

## Create a Node.js run configuration

Procedure:

1. Go to `Run | Edit Configurations`. In the Edit Configuration dialog that opens, click ![the Add New Configuration button ](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg) on the toolbar and select Node.js from the context menu.  The [Run/Debug Configuration: Node.js](run-debug-configuration-node-js.html)  dialog opens.

2. In the File field, specify the path to the main file of the application that starts it (for example, `bin/www` for [Express](http://expressjs.com/) applications).

![Node.js run/debug configuration: JavaScript file specified](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_docker_configure_interpreter_run_configuration.png)

3. If necessary, specify some optional settings as described in [Running and debugging Node.js applications](running-and-debugging-node-js.html#ws_node_run_config_optionally).

4. From the Node runtime list, select the relevant remote Node.js runtime in a Docker environment.

![Node.js with Docker: run/debug configuration, select interpreter](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_docker_run_configuration_select_interpreter.png)

Alternatively,  Click ![the Browse button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.general.ellipsis.svg) next to the Node runtime field  and configure a remote Node.js runtime [as described above](#ws_node_docker_configure_remote_interpreter_preferences_remote_interpreters_dialog).

![Node.js with Docker: run/debug configuration, configure runtime, select Add Remote](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_docker_run_configuration_add_remote.png)

5. Check autogenerated Docker container settings. Click ![the Expand icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.inline.expand.svg) to open the settings in a popup.

![Node.js with Docker: run/debug configuration, Docker container settings](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_docker_run_configuration_docker_container_settings.png)

6. Optionally: configure port bindings [as
described below](#ws_node_docker_create_run_debug_configuration_bind_ports_steps).

Procedure: Configure port binding (optional)

Basically, you need to bind the port on which your application is running with the port of the container.

Click ![the Browse icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.inline.browse.svg) next to the [Edit Docker Container
Settings](#ws_node_debug_docker_container_settings) field and specify the settings in the Edit Docker Container Settings dialog that opens.

1.

Expand the Port bindings  area and click ![the Add button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg) on the toolbar. The Port bindings dialog that opens, map the ports as follows:

2.

Click Modify options and select the options that you want to specify:

![Configure Docker container settings: select the port binding options to specify](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_docker_run_configuration_port_bindings_select_options.png)

3.

* In the Container port field, type the port specified in your application.

* In the Host port field, type an arbitrary port through which you want the application to be accessed from your computer.

* In the Host IP field, type the IP address of the Docker's host. If you are using `localhost`, type `127.0.0.1`. ![Docker: Port binding specified](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_docker_run_configuration_port_bindings.png)

* Click OK to return to the Edit Docker Container Settings dialog where the new port binding is added to the list.

![Docker: Port binding added](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_docker_run_configuration_port_bindings_added.png)

4.

Click OK to return to the [Run/Debug Configuration: Node.js](run-debug-configuration-node-js.html) dialog where the port binding is shown to the Docker container settings field.

![Docker: Port binding added](https://resources.jetbrains.com.cn/help/img/idea/2026.2/node_docker_run_configuration_port_bindings_added.png)

## Run your application

![Running a Node.js application in a Docker container](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_docker_run_app.animated.gif)

Procedure:

1. Create a  Node.js run/debug configuration [as described above](#ws_node_docker_create_run_debug_configuration).

2. From the Select run/debug configuration list on the toolbar, select the [newly created
Node.js configuration](#ws_node_docker_create_run_debug_configuration).

3. Click ![the Run button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.execute.svg)  to the Select run/debug configuration list.

### Check the application output

To make sure the application works as expected, you can run a HTTP request from the IntelliJ IDEA [built-in HTTP Client](http-client-in-product-code-editor.html).

![Node.js with Docker: connect to a running app with a HTTP Request](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_docker_run_http_request.animated.gif)

Procedure:

1. Create a HTTP Request file.

2. Write the following request:

```HTTP_REQUEST
GET http://<host IP>:<container port>/
```

For example:

```HTTP_REQUEST
GET http://127.0.0.1:3010/
```

3. Click ![the Run HTTP Request button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.run.run.svg) in the gutter and click ![the Run HTTP Request button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.run.run.svg) next to Run http://<host IP>:<container port>/.

![Launch a HTTP Request](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_docker_run_http_request_launch.png)

The application output is shown in a separate tab of the Run tool window.

![Application output is shown in the Run tool window](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_docker_run_http_request_output.png)

## Debug your application

![Debugging a Node.js application in a Docker container](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_docker_debug_app.animated.gif)

Procedure:

1. Set the [breakpoints](using-breakpoints.html) in the Node.js code as necessary.

2. Create a  Node.js configuration [as described
above](#ws_node_docker_create_run_debug_configuration), select it from the Select run/debug configuration list on the toolbar, and click ![the Debug button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.debug.svg) next to the list.

3. Proceed as when [starting the debugger together with
a Node.js application locally](running-and-debugging-node-js.html#debugLocal).

## Test your application

With IntelliJ IDEA, you can run [Mocha](http://mochajs.org/) and [Jest](https://jestjs.io/) tests inside a Docker container just in the same way as you do it locally. For more information, refer to [Mocha](running-unit-tests-on-mocha.html) and [Jest](running-unit-tests-on-jest.html).

Procedure:

1. Make sure a relevant remote Node.js runtime in Docker is configured and selected as default for your project. Also make sure the package manager associated with this remote runtime is set as project default. For more information, refer to [Configure a Node.js runtime in Docker](#ws_node_docker_configure_interpreter) and [npm, pnpm, and yarn with Docker](#ws_node_docker_manage_dependencies).

2. Open your `package.json` and make sure the required test framework is listed in the `devDependencies` section:

```JSON
{
  "name": "node-express",
  "version": "0.0.0",
  "private": true,
  "dependencies": {
    "cookie-parser": "~1.4.4",
    "debug": "~2.6.9",
    "express": "~4.16.1",
    "http-errors": "~1.6.3",
    "morgan": "~1.9.1",
    "pug": "^3.0.2"
  },
  "devDependencies": {
    "chai": "^4.3.4",
    "concurrently": "^6.3.0",
    "eslint": "^8.1.0",
    "http-server": "^14.0.0",
    "jest": "^27.3.1",
    "mocha": "^9.1.3",
    "nyc": "^15.1.0"
  }
}
```

3. Right-click anywhere in the editor and select Run '<package manager> install' from the context menu.

4. Create tests according to the instructions from the [Mocha
official website](https://mochajs.org/) or [Jest official website](https://jestjs.io/docs/getting-started).

5. Mark the folder where the unit tests are stored as a test source folder, see [Content roots](content-roots.html).

6. Run and debug single tests right from the editor or create a run/debug configuration to launch some or all of your tests as described in [Running Mocha
tests](running-unit-tests-on-mocha.html#ws_mocha_running), [Debugging Mocha
tests](running-unit-tests-on-mocha.html#ws_mocha_debugging), [Running Jest
tests](running-unit-tests-on-jest.html#ws_jest_running_tests), and [Debugging Jest tests](running-unit-tests-on-jest.html#ws_jest_debugging_tests).

## ESLint with Docker

With IntelliJ IDEA, you can run [ESLint](https://eslint.org/) against your code inside a Docker container just in the same way as you do it locally. For more information, refer to [JavaScript linters](linters.html) and [ESLint](eslint.html).

Procedure:

1. Make sure a relevant remote Node.js runtime in Docker is configured and selected as default for your project. Also make sure the package manager associated with this remote runtime is set as project default. For more information, refer to [Configure a Node.js runtime in Docker](#ws_node_docker_configure_interpreter) and [npm, pnpm, and yarn with Docker](#ws_node_docker_manage_dependencies).

2. Open your `package.json` and make sure ESLint is listed in the `devDependencies` section:

```JSON
{
  "name": "node-express",
  "version": "0.0.0",
  "private": true,
  "dependencies": {
    "cookie-parser": "~1.4.4",
    "debug": "~2.6.9",
    "express": "~4.16.1",
    "http-errors": "~1.6.3",
    "morgan": "~1.9.1",
    "pug": "^3.0.2"
  },
  "devDependencies": {
    "eslint": "^8.1.0"
  }
}
```

3. Right-click anywhere in the editor and select Run '<package manager> install' from the context menu.

4. After that, ESLint works in the same way as when you work with your code locally. View descriptions of detected discrepancies right in the editor or in the Problems tool window and apply suggested quick-fixes. For more information, refer to [JavaScript linters](linters.html) and [ESLint](eslint.html).

![ESLint in a Docker container](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_node_docker_eslint.png)

