Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Docker install Node.js

Docker install Node.js

Node.js is a JavaScript runtime based on the Chrome V8 engine, a development platform that lets JavaScript run on the server side.

1. Check available Node versions

Visit the Node image repository address: https://hub.docker.com/_/node?tab=tags。

You can use Sort by to view other versions of Node; the default is the latest version node:latest。

You can also find other versions you want in the drop-down list:

In addition, we can use the docker search node command to view available versions:



$ docker search node

2. Get the latest node image

Here we pull the official latest-version image:

$ docker pull node:latest

3. View local images

Use the following command to check whether node is installed

$ docker images

In the figure above we can see that we have installed the node image of the latest version (latest).

4. Run the container

After installation, we can use the following command to run the node container:

$ docker run -itd --name node-test node

Parameter Description:

5. Installation successful

Finally, enter the container to check the running node version:

$ docker exec -it node-test /bin/bash

root@6c5d265c68a6:/# node -v