What is Docker and why use it

Docker

31/05/2021


Docker is an open-source platform that allows you to package an application along with its technology stack and dependencies into an isolated container that can be deployed and replicated in practically any environment.

Bit of a mouthful, isn't it? Don't worry, you'll get there.

The problem it solves

To properly understand Docker, you need to know why it exists, i.e. what problem it solves. The problem is called Dependency Hell. 😈

Imagine you've completed your backend web application and you deploy it to a server. Yet, for some reason it's not working as expected. Maybe your API is malfunctioning or suddenly you're missing a dependency.

But wait... I've installed and configured everything the same way as on my local development environment!, you proclaim.

Exactly, this is an issue that many developers have and will continuously encounter throughout their career.

The difference to a VM

In many ways, Docker is like a virtual machine (VM). However, there's one major way in which differ from one another. Let me explain... 😋

Emulation is key

So they both emulate an environment, but the question you should ask yourself is what environment do they emulate?

Layers of an Operation System

Sourced from Wikipedia

The image above shows the different layers of a computer.

  • The bottom layer represents the hardware, e.g. RAM, CPU and Hard Drive.
  • The middle represents the core of the Operation System (OS), 🍎 also known as the Kernel. It communicates between your hardware and applications layer.
  • The top layer represents the software of your computer. This can be "simple" things like a text editor or something more complicated like a file system.

So what's the difference in term of emulation?

Docker only emulates the applications layer of your computer, while a virtual machine emulates the OS Kernel AND applications layer. Consequently, Docker containers are much more lightweight and more compact than a VM.


WRITTEN BY

Code and stuff