Skip to content
Search lessons, topics, tests…
Esc

    ↑ ↓ moveEnter openEsc close

    Module 1 · Images, Containers and WSL · Lesson 1 of 30

    The problem Docker solves

    The problem Docker solves

    Without containers, a developer machine accumulates SDKs, database servers, Redis, RabbitMQ, Node versions, and OS-level dependencies. Two developers can run the same code and get different results because their machines differ. Docker moves most of that environment into versioned artifacts.

    Without Docker vs with Docker

    Without DockerWith Docker
    Install Postgres locally, manage service/versionRun postgres:18-alpine as a disposable container
    Install Redis locallyRun redis:7-alpine and remove it when done
    "Works on my machine" riskImage captures runtime + dependencies
    Manual onboarding documentcompose.yaml can start the whole local stack
    Multiple app versions conflictSeparate containers isolate processes and filesystems

    The lifecycle you should memorize

    1. Get/build an image
    Shell
    docker pull nginx:alpine
    # or
    docker build -t my-api:1.0 .
    1. Create + start a container from the image
    Shell
    docker run -d --name my-api -p 8080:8080 my-api:1.0
    1. Observe/debug it
    Shell
    docker ps
    docker logs -f my-api
    docker inspect my-api
    1. Stop/start the same container
    Shell
    docker stop my-api
    docker start my-api
    1. Remove the container
    Shell
    docker rm -f my-api

    Containers vs virtual machines

    A virtual machine virtualizes hardware and normally runs a complete guest operating system with its own kernel. A Linux container isolates processes using Linux kernel features while sharing the container host's kernel. That is why containers usually start faster and consume less overhead than full VMs.

    TopicContainerVirtual machine
    IsolationProcess/filesystem/network isolationHardware-level virtualization + guest OS
    KernelShares host/container-host kernelOwn guest kernel
    StartupUsually seconds or lessUsually slower
    Image sizeOften MBs to low GBsOften multiple GBs
    Best fitApps, APIs, workers, dependenciesFull OS isolation, different kernels, legacy workloads

    Windows nuance: Linux containers on Windows do not share the Windows kernel. Docker Desktop commonly uses a WSL 2 based Linux environment under the hood. Your containers still see a Linux kernel even though you launch docker commands from PowerShell.

    Core Docker vocabulary

    TermMeaningDeveloper analogy
    DockerfileText recipe used to build an imageBuild recipe / deployment recipe
    ImageRead-only layered filesystem + metadataVersioned application package
    ContainerRunning/stopped instance created from an imageProcess instance + isolated filesystem/network
    RegistryServer that stores imagesNuGet feed for container images
    Docker HubPopular public/private registryPublic package registry
    TagHuman-readable image version label1.0, dev, commit SHA
    LayerCached immutable filesystem changeReusable build cache chunk
    VolumeDocker-managed persistent storageManaged data disk
    Bind mountHost path mounted into containerShared host folder
    NetworkVirtual network for containersPrivate app network / DNS domain
    ComposeDeclarative multi-container definitionLocal stack manifest
    Sign in to mark lessons done and keep your place in the course.Sign in