• Post category:StudyBullet-9
  • Reading time:4 mins read


Learn how to get a Node.js app into a Docker Container

What you will learn

Create a Node js app

Create an Express js Server

Create a Dockerfile

Create a dockerignore file

Build a docker image

Run a docker image

Shut down a docker image

Description

Docker is an open-source project that automates the development, deployment and running of applications inside isolated containers. Containers allow developers to bundle up an application with all of the parts it needs, such as libraries and other dependencies, and ship it as one package.

Docker is both a daemon (a process running in the background) and a client command. It’s like a virtual machine but it’s different in important ways. First, there’s less duplication. With each extra VM you run, you duplicate the virtualization of CPU and memory and quickly run out resources when running locally. Docker is great at setting up a local development environment because it easily adds the running process without duplicating the virtualized resource. Second, it’s more modular. Docker makes it easy to run multiple versions or instances of the same program without configuration headaches and port collisions.


Get Instant Notification of New Courses on our Telegram channel.


The goal of this course is to show you how to get a Node.js application into a Docker container. This course is intended for development, and not for a production deployment. The guide also assumes you have a working Docker installation and a basic understanding of how a Node.js application is structured.  The course covers installation of Docker Desktop just in case you need help.

In the first section of this course we will create a simple web application in Node.js, then we will build a Docker image for that application, and lastly we will instantiate a container from that image.

English
language

Content

Create a Node.js App

Introduction
Installing Node
Install Express
Text Editors
Installing Atom
Create application file
What is Nodemon
Install Nodemon
Send messages to the console
Arrow functions
Const variables
Refactoring Code
Creating a directory for source code

Dockerizing a Node.js App

Install Docker Desktop
Installing Docker Desktop : part 2
Create a Dockerfile
Create a .dockerignore file
Building your image
Running your image
Shut down the image