AcademyContainment Breach: The Architect's ShipZone 2: Structural Blueprints (Images)

Lesson 1: The Blueprint (Docker Images)

Every container starts from an image — a read-only template that contains everything needed to run an application: the code, runtime, libraries, and system tools.

What is a Docker Image?

Think of an image as a snapshot of a fully configured system. It's like a photograph — frozen in time, immutable, and reusable.

Image Layers

Docker images are built in layers, like a layer cake:

┌─────────────────────────────┐
│  Layer 4: COPY app code     │  ← Your application
├─────────────────────────────┤
│  Layer 3: RUN npm install   │  ← Dependencies
├─────────────────────────────┤
│  Layer 2: RUN apt-get       │  ← System packages
├─────────────────────────────┤
│  Layer 1: FROM node:18      │  ← Base image
└─────────────────────────────┘

Each layer is cached. If you change your app code (Layer 4), Docker only rebuilds that layer — not the entire image. This makes builds fast.

Managing Images

docker images                    # List all local images
docker pull nginx                # Download an image
docker rmi nginx                 # Remove an image
docker image prune               # Remove unused images

Image Naming Convention

registry/repository:tag

Examples:
docker.io/library/nginx:1.25          # Full path
nginx:1.25                            # Shorthand (Docker Hub)
nginx:latest                          # Latest version (default)
nginx                                 # Same as nginx:latest
mycompany/webapp:v2.1.0               # Custom image

Popular Base Images

| Image | Size | Use Case | |-------|------|----------| | alpine | ~5 MB | Ultra-minimal Linux | | ubuntu | ~78 MB | Full Ubuntu for learning | | node:18-alpine | ~50 MB | Node.js apps (slim) | | python:3.11-slim | ~52 MB | Python apps (slim) | | nginx:alpine | ~23 MB | Web server |

Inspecting Images

docker inspect alpine              # Full JSON metadata
docker history alpine              # See all layers and sizes
booting...

Mission Objective

Explore the world of Docker images:

  1. Inventory: Run docker images to see what's already on your system.
  2. Download: Pull the ultra-lightweight Alpine image with docker pull alpine.
  3. Investigate: Run docker inspect alpine to see the image's full metadata.

Mission Control

List all local Docker images

Expected Command

docker images

Pull an image from Docker Hub

Inspect an image's details