Skip to the content.

Docker: An Introduction

What is Docker?

Docker is an open-source tool that facilitates the automation of deploying applications inside lightweight, portable, and self-sufficient containers.

Main Features:

Deployments

Before Linux Containers

In the pre-container era, the predominant model for running applications was to use physical servers or virtual machines (VMs).

With Linux Containers

How Does Docker Operate?

At the heart of Docker’s prowess lie several Linux features that enable its unique approach to virtualization:

  1. Control Groups (cgroups): They control resources ensuring Docker containers consume only what they’re allotted.
  2. Namespaces: It offers isolation between containers. Each container feels like it’s the sole process holder.
  3. Chroot: It’s a process to change the root directory for a process, allowing Docker to provide isolated file systems to containers.
  4. Union File Systems (UnionFS): Allows Docker to create layers, making image creation and container spin-up efficient.
  5. Security Modules (e.g., SELinux, AppArmor): They ensure containers cannot negatively impact the host system.

VMs vs Containers

VM vs Dockers Kernel is the Difference

Attributes Virtual Machines (VMs) Containers
System Overhead VMs have a full OS copy, creating higher overhead. With shared host kernel, containers have lesser overhead.
Boot-Up Time VMs boot slower due to a complete OS initialization. Containers boast near-instantaneous boot times.
Performance VMs offer good, but sometimes inefficient performance. Containers, being lightweight, ensure enhanced performance.
Isolation VMs provide stronger isolation since they run separate OS instances. Containers offer good isolation but share the host’s kernel.
Portability VMs can suffer from host-guest OS dependency issues. Docker ensures high portability across any Docker-supporting system.
Security VMs offer great security due to robust resource isolation. Containers, while generally secure, might be vulnerable at kernel-level.
Disk Space VMs require more space (OS + app). Containers only house the app and its dependencies, saving space.
Best Use Cases Suited for tasks needing full OS resources. Ideal for microservices as they scale components effectively.

Docker Installation

2 most popular ways to install Docker locally:

Docker Desktop

Docker Desktop is an easy-to-use graphical user interface (GUI) tool that provides Docker and Kubernetes functionalities for both macOS and Windows users.

Key Features

Advantages

Minikube

Minikube is an open-source tool specifically designed to run a local Kubernetes cluster on your local machine, primarily for the sake of learning and development.

Key Features

Advantages

Docker Desktop vs. Minikube: The Showdown

Criteria Docker Desktop Minikube
Primary Use Case Containerization with Docker, and Kubernetes development. Purely Kubernetes learning and development.
Platform Windows and macOS. Windows, macOS, and Linux.
Hypervisor Dependency Uses underlying platform’s hypervisor. Works with multiple hypervisors.
Networking localhost access on macOS and Windows. IP-based access depending on the hypervisor.
Ease of Use GUI and CLI options. Streamlined setup. More configuration might be required. Pure CLI tool.
Customizability Limited compared to Minikube. High degree of customization using minikube commands.

References

Further Reading

Videos