Dockerizing Node.js

Michele Riva
openmind
Published in
5 min readMay 13, 2019

--

Let’s walk through a Node.js server development process:

  1. Install the newest Node.js version
  2. Install a database for your app (Mongo? CouchDB? MySQL?)
  3. Maybe add ElasticSearch if you want to add some super-fast queries
  4. Test your app on your machine
  5. Deploy it
  6. Watch it fail in production

Well, we all walked this path at least one time, right?
Developing a Node.js app sometimes can be challenging, ’cause you may need a lot of external dependencies (databases, search engines, etc) and sometimes you only test it on your local environment, with different versions of a X database, or the Y service… and then it crashes in production, ’cause the environment is totally different.

Introducing Docker

Docker is a simple but powerful OpenSource project which helps you to develop and deploy any software in any language on a container, which is basically a kind of Virtual Machine.
With Docker, you can run any software/language without even installing it on your machine!

Let’s see an example:

You’ve developed a new incredible chat app with the following stack:

  • Database: CouchDB

--

--