How to install Node.JS & NPM on Docker

- Advertisment -
- Advertisement -

Node.JS and NPM on Docker work in the same as they do on any other OS or machine. The difference is docker runs it on a virtual machine. If you talk about Node.JS, it is a platform built on the Chrome JavaScript runtime and an event-driven I/O server-side JavaScript environment. Based on Google’s V8 engine, the V8 engine executes Javascript very fast and performs very well.

Here we are about to show how we can install LTS version of Node.JS which includes NPM in Docker container.

First thing you should have Docker on your system or server. You can see the tutorials to install it on Windows 10/7 and Ubuntu Linux.

Download Node.js on Docker

Just go to Docker interface and type the below Node pull command:

docker pull node:latest

The above command will install the latest version of the Node.js while writing this article it was v 12.7.0.

Run Node.js on Docker

To run Node on docker use the below

docker run -it node

Install Node JS on Docker

However, to install the current LTS version that is v10.16.1, you can use its tag.

  • tag- 10.16.1-stretch-slim  size- 55 MB
  • tag- 10.16.1-stretch size- 348 MB
  • tag- lts size- 348 MB

For that the Command will be like this:

docker pull node:10.16.1-stretch-slim
docker pull node:10.16.1-stretch 
docker pull node:lts

So to run the 10.16.1-stretch

The command will be the:

docker run -it 10.16.1-stretch node

If you think that running docker with such a long tag name is a little bit cumbersome then give name to the image name.

For example, to run a particular version of a node when there are multiple images have been installed; we have to define a tag in a command. Thus if we have the latest version of the node along with some other version such as 10.16.1-stretch, so the command will be like this

docker run -it tag imagename

docker run -it 10.16.1-stretch node

To make it easy we can simply tag a new image name to our existing image.

Suppose we want to tag a name node10 with node:10.16.1-stretch then the command will be


docker run -it node:10.16.1-stretch node10

That’s it, now you can simply run the 10.16.1-stretch of a using a simple command

docker run -it node10

For more Node.Js official Docker tags you can visit the official website of Docker.

H2S Media Team
H2S is a group of tech enthusiasts those are passionate about latest technology developments. They always like to solve own technical problems and share the same solution with others through this Website.


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest Posts

Signs of Failing Hard drive that you should never ignore

The hard drive is undoubtedly one of the most important components of your computer, even though your computer cannot...

Prominent Edtech startups that are changing the way students learn

Education technology startups play a key role. Challenging the traditional education ecosystem, online education has now grown deep into...

How to enable Virtualbox nested VTX/Amd-V

Do you want to run Virtual machine inside a Virtual Box VM then you have to enable the nested...

UBON introduces SP-6850 Portable speaker priced at INR 1,799/-

UBON electronic brand recently has announced a new portable speaker UBON SP-6850 ‘Entertainment Box’ with in-built radio connectivity along...
- Advertisement -

Top 10 podcast apps that you should download on your Android

Video-on-demand platforms like Netflix, Prime Video, Hulu are pretty popular among users, and I don't think I need to...

9 Best Indian Movies Games Available on the Google Play store

Most of the Indians are crazy about two things, Bollywood and cricket. We can see that most of the...

- Advertisment -
- Advertisement -

You might also likeRELATED
Recommended to you