Skill-Lite

Practical tutorials & tools for modern developers.

Home/Docker/Introduction

Introduction to Docker

Docker is an open platform for developing, shipping, and running applications inside lightweight, portable containers. It eliminates the classic "works on my machine" problem by packaging your app and everything it needs into a single, reproducible unit.

The problem Docker solves

Before containers, deploying software meant wrestling with environment differences — the developer's laptop ran a different OS version than staging, which differed from production. Library versions drifted, configurations clashed, and deployments were risky.

Docker packages an application together with its runtime, libraries, environment variables, and configuration into a container image. That image runs identically everywhere Docker is installed: a laptop, a CI server, or a cloud VM.

Containers vs. Virtual Machines

Virtual MachineDocker Container
IsolationFull OS per VMShared host kernel
SizeGigabytesMegabytes
StartupMinutesMilliseconds
OverheadHigh (hypervisor)Near zero
PortabilityVM image is large & format-specificSame image anywhere Docker runs

Containers are not VMs — they share the host OS kernel and are isolated using Linux namespaces and cgroups. This makes them dramatically lighter and faster to start.

Docker Engine components

Docker CLI

  • docker build — build an image
  • docker run — start a container
  • docker push/pull — share images

Docker Daemon (dockerd)

  • Manages images, containers, networks, volumes
  • Listens on a UNIX socket
  • Calls the container runtime

Container Runtime

  • containerd manages container lifecycle
  • runc creates & runs containers
  • OCI-compliant

Core vocabulary

TermDefinition
ImageA read-only, layered template. Every container starts from an image.
ContainerA running (or stopped) instance of an image. Writable layer on top.
DockerfileA text file with instructions to build an image step by step.
LayerEach Dockerfile instruction creates a cached, immutable filesystem layer.
RegistryA server that stores and distributes images (e.g. Docker Hub).
TagA human-readable label for a specific image version (e.g. nginx:1.27).
VolumeA managed storage mount that persists data beyond the container's life.
NetworkA virtual network that connects containers to each other and the outside world.

Installing Docker

The recommended way to install Docker on any platform is Docker Desktop (Mac, Windows) or the Docker Engine package on Linux.

# Linux — add the official Docker repo, then install
curl -fsSL https://get.docker.com | sh

# Verify installation
docker version
docker info
Docker Desktop bundles the daemon, CLI, Docker Compose, and a local Kubernetes cluster in one installer. On Mac and Windows it runs a lightweight Linux VM transparently.

Your first container

# Pull and run the official hello-world image
docker run hello-world

# Run an interactive Ubuntu shell — exit to stop
docker run -it ubuntu bash

# Run nginx and publish port 80 to localhost:8080
docker run -d -p 8080:80 --name my-nginx nginx

# See what's running
docker ps

# Stop and remove
docker stop my-nginx
docker rm my-nginx
How docker run nginx works: Docker checks for the image locally → not found → pulls nginx:latest from Docker Hub → creates a container layer → starts the container process.

How this tutorial is organised

  1. Getting Started — this page, then Images & Dockerfiles.
  2. Core Concepts — Containers, Volumes, and Networking.
  3. Tooling — Docker Compose for multi-container apps, and Registries for sharing images.
  4. Reference — a full Docker CLI cheat sheet.