Setting up a New Ubuntu Docker Container for NodeJS

Setting up a New Ubuntu Docker Container for NodeJS

When you pull a new ubuntu machine from docker hub, you get a minimal machine that is close to useless. It doesn't even come with curl 😱. I know right? Very surprising. So to set it up, follow these steps.

If you want to follow along, head over to Docker Labs and create an instance.

Play with Docker

Step 1: Install ubuntu latest

docker pull ubuntu

docker run -it ubuntu

Step 2: update and upgrade

Now, update and upgrade Ubuntu using apt update and upgrade. Prepend sudo if admin privileges are needed.

apt update && apt upgrade

Step 3: Install curl

Curl will enable you to install NodeJS and a ton of other software.

apt install curl

Step 4: Install Nodejs

Finally, install Nodejs using the commands below.

curl -sL https://deb.nodesource.com/setup_lts.x
apt-get install -y nodejs

Choose your geographical area and time zone.

Geographical Area and Timezone

Finally, install the necessary build tools.

apt-get install -y build-essential

Step 5: Install npm

Does this come with Nodejs? Not always. The installation is easy too

apt install npm

npm takes forever to install, but once ready, you can start pulling heaven and earth. Sorry, npm modules πŸ˜….

Step 6: Install git (Optional)

Can you think of software development without git πŸ€”? Me neither. Let's install git with this command

apt install git

That should get git up and running. You can now pull any repo of your choice. At this point you may be thinking, why not package all these into an image? That's a great idea and the basis of my next post. Stayed tuned.

Happy Javascripting πŸ‘‹ and thanks for reading. Adios ✌🏾🧑.

Β