Skip to content

You are viewing a free preview of this lesson.

Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.

What is Docker?

What is Docker?

Docker is an open-source platform that lets you package, ship, and run applications inside isolated environments called containers. Rather than shipping code and hoping it works on someone else's machine, Docker lets you bundle the code together with everything it needs — the runtime, libraries, configuration files, and system tools — into a single portable unit.

The Problem Docker Solves

Software development has always suffered from the "works on my machine" problem. A developer writes code that runs perfectly on their laptop, but when it reaches the staging server or a colleague's workstation, something breaks. Maybe the Node version is different. Maybe a library is missing. Maybe an environment variable is set differently.

Traditional solutions — virtual machines, manual documentation of dependencies, shared environment scripts — are slow, fragile, or both. Docker solves this by making the environment itself part of the deliverable.

Containers vs. Virtual Machines

A virtual machine (VM) emulates an entire computer, including its own operating system kernel. This makes VMs heavy: a typical VM might use several gigabytes of disk and take minutes to boot.

A container shares the host operating system's kernel but runs in an isolated user-space environment. This makes containers:

  • Lightweight — containers start in milliseconds and use megabytes, not gigabytes
  • Portable — the same container image runs identically on a laptop, a CI server, or a cloud VM
  • Efficient — you can run dozens of containers on hardware that supports only a handful of VMs

How Docker Works

Docker uses several Linux kernel features — namespaces for isolation and cgroups for resource limits — to create containers. On macOS and Windows, Docker Desktop runs a small Linux VM transparently so you get the same experience everywhere.

The key components are:

  • Docker Engine — the daemon (dockerd) that manages containers on your machine
  • Docker CLI — the command-line tool (docker) you use to interact with the daemon
  • Docker Hub — the public registry where images are stored and shared
  • Docker Desktop — the GUI application for macOS and Windows that bundles all of the above

A First Look at Docker

# Pull an image from Docker Hub
docker pull hello-world

# Run a container from that image
docker run hello-world

# List running containers
docker ps

# List all containers (including stopped)
docker ps -a

The docker run hello-world command downloads a tiny image, starts a container from it, prints a friendly message, and exits. Behind the scenes Docker checked whether the image existed locally, pulled it from Docker Hub because it did not, created a container, ran its default command, and cleaned up.

Why Docker Matters

Docker transformed how software is built and deployed. Before Docker, deploying an application meant logging into a server, installing dependencies, and hoping nothing conflicted. With Docker, you build an image once and run it anywhere.

Key benefits include:

  • Reproducibility — the same image produces the same behaviour on every machine
  • Isolation — multiple applications can run on the same host without interfering with each other
  • Speed — containers start and stop in seconds, enabling fast iteration and testing
  • Scalability — container orchestrators like Kubernetes can start or stop hundreds of containers automatically in response to load

Docker has become a fundamental skill for backend developers, DevOps engineers, and anyone who deploys software to the cloud.