Skip to content
Cuelogic
  • Services
        • Product Engineering
          • Product Development
          • UX Consulting
          • Application Development
          • Application Modernization
          • Quality Assurance Services
        • Cloud Engineering
          • Cloud Services
          • DevOps Services
          • Cloud Migration
          • Cloud Optimization
          • Cloud Computing Services
        • Data & Machine Learning
          • Big Data Services
          • AI Consulting
        • Internet of Things
          • IoT Consulting
          • IoT Application Development
        • Innovation Lab as a Service
        • Cybersecurity Services
        • Healthcare IT Services
  • Company
    • About
    • Culture
    • Current Openings
  • Insights
  • Tell Us Your Project
Tell Us Your Project  ❯
DevOps  3 Mins Read  January 29, 2018  Cuelogic Insights

Why And How To Containerize Modern NodeJS Applications

Share Via –
Share on facebook
Share on twitter
Share on linkedin

Home > Why And How To Containerize Modern NodeJS Applications

Imagine you write your code, wrap it up, and deliver it straight to your friend - gift-wrapped as a present. This is containerization of apps in a nutshell.  Containerization is a concept, that lets you open up your presents for Christmas and fit it straight into a puzzle, the puzzle being your complete software package.

Besides offering a blend of portability, ease of use with different coding stacks, and code reusability, let's discuss why you should consider containerizing your Node.JS apps with Docker and how to get it done.

ocker-application-development-process

The Benefits

Whether you outsource software development or do it in-house, there are plenty of benefits to be utilized using containerization of apps. Let's take a look below.

  1. App Execution In Isolated Runtime Environments with Virtual OS
  2. Virtualizing of OS allows applications to be distributed across a single host without the need of running Virtual Machines through access to a single OS kernel
  3. All apps run on the same Linux Kernel, thus saving hardware resources and improving boot times
  4. Multiple containerized apps can be run concurrently on a single server
  5. Simplifies DevOps deployment workflows as all runtime differences get encapsulated within containers. Docker apps are executable in different framework stacks.
  6. No need to set up or install libraries, packages, configuration files, etc.
  7. The working environment remains the same whether the container is run on development, staging, or production servers.

Undoubtedly, scalability is the biggest bonus point of app containerization as you get to add on or remove containers based on your choice in bespoke software development pipelines.

How To Containerize Modern Node JS Applications

In this article, we'll discuss how to containerize a very basic "hello world" Node.JS app using Docker and run it on another port besides your localhost. You can apply the same steps for your other Node.JS files no matter the code complexity since the concept in Node.Js remains the same. Let's begin.

  1. Visit Docker.com and download the Docker Enterprise Edition from the official website.docker-cloud
  2. Initialize the "hello world" file with npm init.
  3. Install npm manager and run Express Framework with the following line-npm install --save express
  4. Create an index.js file for your app code using this line-
    touch index.js
  5. Open up your favorite code editor now. We'll proceed with Microsoft Visual Studio in this example.Microsoft Visual Studio in this example
  6. Create a Docker image since that's needed to run your code inside a Docker container. Open up Command Line and write down the following code to create a Docker file (a text file that tells Docker how to create a Docker image) and make that happentouch Dockerfile
  7. Go back to your code editor and change the local port value to your desired choice on Line 7.code editor and change the local port value
  8. Run the CLI (Command Line Interface) and type in the following lines to finally create your Docker builddocker build -t hello-world .
  9. Run your Docker image inside a container with the following command-

docker run -p 8082:(local port) hello-world

Docuker program result

And voila! You should find your app running inside your Docker container.

Did you like this post? Comment below and let us know your thoughts!

Recommended Content
What is Infrastructure as Code and How Can You Leverage It? ❯
Decoding Pipeline as Code (With Jenkins) ❯
Tags
containers docker Docker Enterprise Edition javascript framework Node.js NodeJs
Share This Blog
Share on facebook
Share on twitter
Share on linkedin

Leave a Reply Cancel reply

People Also Read

Big Data

Data Mesh – Rethinking Enterprise Data Architecture

8 Mins Read
Consulting

Top Technology Trends for 2021

10 Mins Read
DevOps

What is Infrastructure as Code and How Can You Leverage It?

8 Mins Read
Subscribe to our Blog
Subscribe to our newsletter to receive the latest thought leadership by Cuelogic experts, delivered straight to your inbox!
Services
Product Engineering
  • Product Development
  • UX Consulting
  • Application Development
  • Application Modernization
  • Quality Assurance
Menu
  • Product Development
  • UX Consulting
  • Application Development
  • Application Modernization
  • Quality Assurance
Data & Machine Learning
  • Big Data Services
  • AI Consulting
Menu
  • Big Data Services
  • AI Consulting
Innovation Lab as a Service
Cybersecurity Services
Healthcare IT Solutions
Cloud Engineering
  • Cloud Services
  • DevOps Services
  • Cloud Migration
  • Cloud Optimization
  • Cloud Computing Services
Menu
  • Cloud Services
  • DevOps Services
  • Cloud Migration
  • Cloud Optimization
  • Cloud Computing Services
Internet of Things
  • IoT Consulting
  • IoT App Development
Menu
  • IoT Consulting
  • IoT App Development
Company
  • About
  • Culture
  • Current Openings
Menu
  • About
  • Culture
  • Current Openings
We are Global
India  |  USA  | Australia
We are Social
Facebook
Twitter
Linkedin
Youtube
Subscribe to our Newsletter

We don't spam!

cuelogic

We are Hiring!

Blogs
  • What is Infrastructure as Code and How Can You Leverage It?
  • Cypress vs. Selenium: Which is the Superior Testing Tool?
  • Micro Frontend Deep Dive – Top 10 Frameworks To Know About
  • Micro Frontends – Revolutionizing Front-end Development with Microservices
  • Decoding Pipeline as Code (With Jenkins)
  • DevOps Metrics : 15 KPIs that Boost Results & RoI
Menu
  • What is Infrastructure as Code and How Can You Leverage It?
  • Cypress vs. Selenium: Which is the Superior Testing Tool?
  • Micro Frontend Deep Dive – Top 10 Frameworks To Know About
  • Micro Frontends – Revolutionizing Front-end Development with Microservices
  • Decoding Pipeline as Code (With Jenkins)
  • DevOps Metrics : 15 KPIs that Boost Results & RoI
cuelogic

We are Hiring!

Blogs
  • What is Infrastructure as Code and How Can You Leverage It?
  • Cypress vs. Selenium: Which is the Superior Testing Tool?
  • Micro Frontend Deep Dive – Top 10 Frameworks To Know About
  • Micro Frontends – Revolutionizing Front-end Development with Microservices
  • Decoding Pipeline as Code (With Jenkins)
  • DevOps Metrics : 15 KPIs that Boost Results & RoI
Menu
  • What is Infrastructure as Code and How Can You Leverage It?
  • Cypress vs. Selenium: Which is the Superior Testing Tool?
  • Micro Frontend Deep Dive – Top 10 Frameworks To Know About
  • Micro Frontends – Revolutionizing Front-end Development with Microservices
  • Decoding Pipeline as Code (With Jenkins)
  • DevOps Metrics : 15 KPIs that Boost Results & RoI
We are Global
India  |  USA  | Australia
We are Social
Facebook
Twitter
Linkedin
Youtube
Subscribe to our Newsletter

We don't spam!

Services
Product Engineering

Product Development

UX Consulting

Application Development

Application Modernization

Quality Assurance Services

Cloud Engineering

Cloud Services

DevOps Services

Cloud Migration

Cloud Optimization

Cloud Computing Services

Data & Machine Learning

Big Data Services

AI Consulting

Internet of Things

IoT Consulting

IoT Application Services

Innovation Lab As A Service
Cybersecurity Services
Healthcare IT Services
Company

About

Culture

Current Openings

Insights
Privacy Policy  
All Rights Reserved @ Cuelogic 2021

Close

By continuing to use this website, you consent to the use of cookies in accordance with our Cookie Policy.