Docker Install Node.js

Docker Install Node.js

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

1. Check for available Node versions

Visit the Node mirror repository at https://hub.docker.com/_/node?tab=tags.

You can view other versions of Node by Sort by, the default is the latest version node:latest.

Docker Install Node.js

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

Docker Install Node.js

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

$ docker search node

2. fetch the latest version of the node image

Here we pull the official latest version of the image:

$ docker pull node:latest

Docker Install Node.js

3. Check the local image

Use the following command to see if node is installed:

$ docker images

Docker Install Node.js

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

4. Run the container

Once the installation is complete, we can run the node container using the following command.

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

Parameters description.

  • –name node-test: the name of the container.

Docker Install Node.js

5. Successful installation

Finally, go to the node version that the container is running on:

$ docker exec -it node-test /bin/bash
root@6c5d265c68a6:/# node -v

Docker Install Node.js

Like(0)