How to Dockerize a Node.js application
Node.js and Docker. If you haven't spent the last 7 years in an underwater cave playing solitaire on a coral bed, you must have at least heard of these two ever-trending techs in the web development industry. In this article we'll show you how to create a Docker image for an application written in Node.js.
Why should I dockerize my application
You might've heard about the whole Docker thing, but that still doesn't answer the question: "why bother?" Well, that's why:
- You can launch a fully capable development environment on any computer supporting Docker; you don't have to install libraries, dependencies, download packages, mess with config files etc.
- The working environment of the application remains consistent across the whole workflow. This means the app runs exactly the same for developer, tester, and client, be it on development, staging or production server.
In short, Docker is the counter-measure for the age-old response in the software development: "Strange, it works for me!"
FULL GUIDE--> buddy.works
CONTENTS:
- Why should I dockerize my application
- Part 1: Creating Node.js application
- Install Node.js
- Install NPM and Express Framework
- Details of Hello World
- Run the app
- Automate builds & tests of Node apps in 10 minutes
- Part 2: Dockerizing Node.js application
- Install Docker
- Write Dockerfile
- Build Docker image
- Run Docker container
- Sharing Docker image
- Build & run Docker images on every change to code
- Deploying dockerized application to server