Develop Node.js based applications. Includes Node.js, eslint, nvm, and yarn.
Metadata | Value |
---|---|
Contributors | The VS Code Team |
Definition type | Dockerfile |
Published image | mcr.microsoft.com/vscode/devcontainers/javascript-node |
Available image variants | 10, 12, 14 |
Published image architecture(s) | x86-64 |
Works in Codespaces | Yes |
Container host OS support | Linux, macOS, Windows |
Languages, platforms | Node.js, JavaScript |
While the definition itself works unmodified, you can select the version of Node.js the container uses by updating the VARIANT
arg in the included devcontainer.json
(and rebuilding if you've already created the container).
"args": { "VARIANT": "12" }
You can also directly reference pre-built versions of .devcontainer/base.Dockerfile
by using the image
property in .devcontainer/devcontainer.json
or updating the FROM
statement in your own Dockerfile
with one of the following:
mcr.microsoft.com/vscode/devcontainers/javascript-node
(latest)mcr.microsoft.com/vscode/devcontainers/javascript-node:14
mcr.microsoft.com/vscode/devcontainers/javascript-node:12
mcr.microsoft.com/vscode/devcontainers/javascript-node:10
Version specific tags tied to releases in this repository are also available.
mcr.microsoft.com/vscode/devcontainers/javascript-node:0-14
mcr.microsoft.com/vscode/devcontainers/javascript-node:0.123-14
mcr.microsoft.com/vscode/devcontainers/javascript-node:0.123.0-14
Alternatively, you can use the contents of the Dockerfile
to fully customize your container's contents or to build it for a container host architecture not supported by the image.
Beyond Node.js and git
, this image / Dockerfile
includes eslint
, zsh
, Oh My Zsh!, a non-root vscode
user with sudo
access, and a set of common dependencies for development. Node Version Manager (nvm
) is also included in case you need to use a different version of Node.js than the one included in the image.
Just follow these steps:
-
If this is your first time using a development container, please follow the getting started steps to set up your machine.
-
To use the pre-built image:
- Start VS Code and open your project folder.
- Press F1 select and Remote-Containers: Add Development Container Configuration Files... from the command palette.
- Select the Node.js 14 definition.
-
To use the Dockerfile for this definition (rather than the pre-built image):
- Clone this repository.
- Copy the contents of
containers/javascript-node/.devcontainer
to the root of your project folder. - Start VS Code and open your project folder.
-
After following step 2 or 3, the contents of the
.devcontainer
folder in your project can be adapted to meet your needs. -
Finally, press F1 and run Remote-Containers: Reopen Folder in Container to start using the definition.
This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:
- If this is your first time using a development container, please follow the getting started steps to set up your machine.
- Clone this repository.
- Start VS Code, press F1, and select Remote-Containers: Open Folder in Container...
- Select the
containers/javascript-node
folder. - After the folder has opened in the container, press F5 to start the project. This will automatically run
npm install
before starting it. - Once the project is running, press F1 and select Remote-Containers: Forward Port from Container...
- Select port 3000 and click the "Open Browser" button in the notification that appears.
- You should see "Hello remote world!" after the page loads.
- From here, you can add breakpoints or edit the contents of the
test-project
folder to do further testing.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See LICENSE.