Skip to main content

What is Docker?

Docker is a software platform that allows you to build, test, and deploy applications quickly. It does this by packaging software into standardized units called containers.

The eternal problem in programming used to be: "It works on my machine". A project ran perfectly on the developer's laptop (Windows), but when uploaded to the production server (Linux), or the Node.js version was different from expected, or an environment variable was missing, the application crashed.

Docker solved this.

Containers vs Virtual Machines (VMs)

To understand Docker's genius, we must compare it with the previous technology: Virtual Machines (like VirtualBox or VMWare).

The era of Virtual Machines

Before, if you wanted to isolate three different applications on a single physical server, you created three Virtual Machines. Each VM requires its own complete Guest Operating System (Guest OS) (e.g. a full 20GB Windows or a 2GB Ubuntu). This consumed a lot of RAM, too much hard drive, and took minutes to boot.

The era of Containers

Containers change the rules of the game. They do not include a full operating system. Instead, all containers "share" the core (Kernel) of the computer's operating system that runs them.

Docker Container Advantages:

  1. Ultra lightweight: They weigh Megabytes instead of Gigabytes.
  2. Fast: They boot in milliseconds instead of minutes (because they don't have to start an OS, just a process).
  3. Absolute portability: If a container runs on your laptop, it is 100% guaranteed to run exactly the same on AWS, Google Cloud, or your coworker's server.

The Docker Ecosystem: Core Concepts

To speak "Docker", you must know these three words:

  1. Dockerfile: It is the "source code" or recipe. It is a simple text file with step-by-step instructions on how to build the environment (e.g.: "Install Ubuntu, then install Python 3, then copy my files, and finally run my web app").
  2. Image: It is the result of "cooking" the Dockerfile. It is a static, read-only package with your application and its dependencies inside. Think of the image as an installation CD or a mold.
  3. Container: It is a "living" instance of an Image. If the image is the CD, the container is the game running in RAM and processor. You can run 50 identical containers from 1 single Image.