Chapter 0210 mins • beginner
Docker Images & Layers
Blueprints, Registries, Layers & Immutability
What You Will Master:
Differentiate between an Image (Blueprint) and a Container (Instance)
Understand read-only image layers and union filesystems
Use `docker pull`, `docker images`, and `docker rmi`
Image vs. Container: The Blueprint Analogy
Think of a **Docker Image** as an architect's blueprint or a class in object-oriented programming. It is an immutable, read-only template containing the OS files, dependencies, and application code.
A **Container** is a running instance of that blueprint—just like an instantiated object in memory. You can create dozens of separate containers from a single image.
Layer Stack & Union Filesystem
Docker images are built as stacks of **read-only layers**. Each instruction in a build adds a new layer:
* **Base Layer**: Minimal Linux filesystem (e.g. Alpine 7MB)
* **Dependency Layer**: Packages installed via apt/apk
* **Application Layer**: Source code and configs
When multiple images share common base layers, Docker only downloads and stores the layer once on disk!
Interactive Lab
Pull and Inspect an Image
Pull the lightweight `postgres:16-alpine` database image into your local image cache.
0/1 Steps Done
Step 1: Pull the postgres:16-alpine image
Run `docker pull postgres:16-alpine` in the terminal.
Chapter Knowledge Check
Take the interactive MCQ test to unlock bonus XP
Sponsor & Resources