🐳 Interactive Beginner Lesson • Docker from Ground Zero V2

Learn Docker step by step, from installing it on your computer to running your first real container.

This lesson starts at absolute zero. It now includes separate installation walkthroughs for Windows, Mac, and Ubuntu, then moves into first run, images, containers, Dockerfiles, Compose, and practice.

Windows guide Mac guide Ubuntu guide Interactive first run Dockerfile practice Quiz included
Most beginners should install Docker Desktop first. On Windows, Docker Desktop commonly uses the WSL 2 backend. On Ubuntu, you can choose Docker Desktop or Docker Engine. On all platforms, the classic first verification step is docker run hello-world.

1) Choose your platform

Docker’s official documentation supports Windows, Mac, and Linux. Docker Desktop is the one-click install route for Windows, Mac, and Linux, while Docker Engine is the direct Linux engine route. 1

Windows path

Docker Desktop for Windows is the usual beginner choice, and Docker provides a dedicated Windows install page with download links, system requirements, and install steps. Docker also documents WSL 2 support and notes that mixed Docker installs directly inside WSL distributions can cause conflicts. 2

Best for Beginners on Windows laptops and desktops who want the easiest path.
Important concept Docker Desktop on Windows commonly uses the WSL 2 backend.

Mac path

Docker provides a dedicated Mac install page for Docker Desktop, including guidance for Apple silicon and Intel Macs. 3

Best for Mac users who want a straightforward install and integrated GUI.
Important concept Download the installer that matches your Mac hardware type.

Ubuntu path

On Ubuntu, you have two mainstream beginner choices: Docker Desktop for Ubuntu or Docker Engine from Docker’s apt repository. Docker’s docs describe both paths. 4

Docker Desktop path Easiest if you want a desktop application and a guided beginner experience.
Docker Engine path More direct and common for servers, command-line focused setups, and Linux-heavy workflows.

Which should I choose?

Windows Start with Docker Desktop.
Mac Start with Docker Desktop.
Ubuntu Start with Docker Desktop if you want easy onboarding. Choose Engine if you want the more server-style Linux path.

2) Install Docker

Docker’s official “Get Docker” docs point users to platform-specific installation routes. Docker Desktop is the easiest route for Windows, Mac, and Linux, while Docker Engine installation pages are the Linux engine route. 5

General beginner path: Docker Desktop

Download
Install
Open Docker Desktop
Wait for Docker to run
Verify in terminal
Step 1: Open the Docker Desktop download page Choose Windows, Mac, or Linux.
Step 2: Download the installer Make sure it matches your system.
Step 3: Run the installer Follow the setup screens.
Step 4: Open Docker Desktop Let it finish starting up.
Step 5: Open a terminal Use PowerShell, Command Prompt, Terminal, or your Linux terminal.
Step 6: Verify it Run docker --version.
# Check Docker
docker --version

# Check Compose
docker compose version

Windows details

Docker’s Windows install page includes system requirements and step-by-step installation guidance. Docker’s WSL docs also say Docker Desktop should be installed on Windows itself, and that older Docker installations directly inside a WSL distribution can conflict. 6

Step 1 Download Docker Desktop for Windows from the official page.
Step 2 Run the installer.
Step 3 Let Docker Desktop configure its required components.
Step 4 Open Docker Desktop and wait until it says Docker is running.
Step 5 Open PowerShell or Windows Terminal and run the check commands.
docker --version
docker run hello-world
Windows tip: if you work with WSL 2, check Docker Desktop settings for WSL integration after Docker starts.

Mac details

Docker’s Mac page includes install guidance and distinguishes between Apple silicon and Intel chip downloads. 7

Step 1 Choose the correct Docker Desktop installer for your Mac.
Step 2 Install Docker Desktop.
Step 3 Start Docker Desktop.
Step 4 Open Terminal and verify the installation.
docker --version
docker run hello-world

Ubuntu Desktop details

Docker’s Ubuntu Desktop page recommends setting up Docker’s package repository, downloading the latest DEB package, and installing it with apt. 8

Step 1 Set up Docker’s package repository.
Step 2 Download the latest Docker Desktop DEB package.
Step 3 Install it with apt.
Step 4 Launch Docker Desktop.
Step 5 Verify from the terminal.
sudo apt-get update
sudo apt install ./docker-desktop-amd64.deb

docker --version
docker run hello-world

Ubuntu Engine details

Docker’s Ubuntu Engine page says Docker Engine is installed through supported methods such as Docker’s apt repository, and notes that conflicting old packages should be removed first. It also documents optional Linux post-install steps such as using Docker as a non-root user. 9

Step 1 Remove conflicting older or unofficial packages if Docker’s docs tell you they are present.
Step 2 Set up Docker’s apt repository.
Step 3 Install Docker Engine and related components from the official repository.
Step 4 Run the verification command.
Step 5 Optionally configure non-root usage and start-on-boot behavior.
docker --version
sudo docker run hello-world
On Ubuntu Engine installs, it is normal to need sudo until you complete Linux post-install configuration.
Do I need Docker Compose separately?

Docker Desktop includes Compose. On Linux Engine paths, Docker documents a Compose plugin installation route if needed. 10

Should I install Docker from random scripts?

For beginners, it is safer to follow the official Docker installation pages for your platform.

3) Run Docker for the first time

The goal of your first Docker session is simple: confirm that Docker is alive and can run a container. The classic test is docker run hello-world. 11

Minimal first-run checklist
  1. Make sure Docker Desktop is open, or the Docker service is running.
  2. Open your terminal.
  3. Run docker --version.
  4. Run docker run hello-world.
  5. If that works, you are ready to learn real Docker usage.
What hello-world proves

It proves that the Docker engine is reachable.

It proves image download and container start worked.

It proves your install is basically healthy.

docker --version
docker run hello-world
1. Installed
2. Started
3. Pulled image
4. Ran container
First Run Simulator
$ Click the buttons below to simulate your first Docker run...
If hello-world works, celebrate that moment. It means several parts of Docker worked together successfully.
If it fails, common reasons are: Docker is not started yet, the terminal was opened before Docker started, or on Linux you may need sudo.

4) Docker at ground zero

Docker helps you package an application together with what it needs to run. Instead of saying, “It works on my machine,” you create a standard package so it behaves more consistently elsewhere.

Without Docker Different machines can end up with different runtimes, packages, and settings.
With Docker You define the environment once and run containers from that definition.
Big idea Docker standardizes packaging and running. It does not replace understanding your app.
Think of Docker as a way to put your app into a predictable box.
Your code
app.py, server.js, package.json, config, assets
Docker image
A packaged blueprint for your app
Container
A running instance created from the image

5) The mental model you must understand

Many beginners confuse Docker, image, container, Dockerfile, and Compose. These are not the same thing.

Docker

The overall platform and tooling for containers.

Click to flip

Remember it like this

Docker is the full system. It is bigger than one container.

Image

A blueprint or packaged template.

Click to flip

Remember it like this

You build an image once and can create multiple containers from it.

Container

A running instance created from an image.

Click to flip

Remember it like this

Image is the blueprint. Container is the running thing.

Dockerfile

A file containing instructions for building an image.

Click to flip

Remember it like this

You do not run a Dockerfile directly. You build from it.

Compose

A way to define and run multi-container applications.

Click to flip

Remember it like this

Use Compose when your app needs multiple connected services.

Registry

A place where images are stored, like Docker Hub.

Click to flip

Remember it like this

You pull images from registries and can push your own there too.

Quick summary:

Docker      = the platform
Dockerfile  = instructions to build an image
Image       = packaged blueprint
Container   = running instance from an image
Compose     = tool for multi-container apps

6) Your first important Docker commands

Learn the command pattern first. It removes a lot of confusion.

docker --version Checks Docker installation.
First check
docker pull nginx Downloads the nginx image.
Get an image
docker run nginx Creates and starts a container from nginx.
Run a container
docker ps Lists running containers.
See running
docker ps -a Lists all containers, including stopped ones.
See all
docker stop CONTAINER_ID Stops a running container.
Stop
docker start CONTAINER_ID Starts an existing container again.
Restart later
docker images Lists local images.
See images
Beginner Docker Simulator
$ Try clicking commands below...
Easy rule: pull gets an image, run starts a container, ps lists containers, stop and start control them.

7) Dockerfile — the recipe for your image

A Dockerfile is a plain text file that tells Docker how to build your image.

Simple Python example
FROM python:3.13
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "app.py"]
Meaning

FROM chooses a base image.

WORKDIR sets the working folder.

COPY copies files into the image.

RUN executes build-time commands.

CMD sets the default startup command.

Click the button to break the Dockerfile into step-by-step meaning.
Typical build command:
docker build -t myapp:1.0 .

Typical run command:
docker run -p 3000:3000 myapp:1.0
What does -t mean?

It tags the image with a readable name like myapp:1.0.

What does -p 3000:3000 mean?

It maps a host port to a container port.

8) Docker Compose — when one container is not enough

Real applications often need multiple services such as a web app and a database. Compose lets you define and run them together. Docker documents Compose as the way to define and run multi-container applications. 12

web
Your app service
db
Database service
cache
Optional Redis service
Example compose file
services:
  web:
    build: .
    ports:
      - "3000:3000"
    depends_on:
      - db

  db:
    image: postgres:16
    environment:
      POSTGRES_PASSWORD: secret
Why this helps

You start related services together.

You stop them together.

Your team gets a shared local environment.

Useful Compose commands:
docker compose up
docker compose up --build
docker compose down
docker compose ps
docker compose logs
Use plain Docker first to learn the basics. Add Compose when one service is no longer enough.

9) A real beginner workflow

Here is a simple workflow that works for many small projects.

Step 1: Write the app Build your files as usual.
Step 2: Write the Dockerfile Describe how the app should be packaged.
Step 3: Build the image Use docker build.
Step 4: Run the container Use docker run.
Step 5: Test it Open it in the browser or call the API.
Step 6: Use Compose later Add services when your app grows.

10) Common beginner mistakes

Mistake: image vs container confusion They are not the same thing.
Mistake: forgetting ports Your app may run inside the container but still be invisible outside it.
Mistake: copying everything too early Instruction order can affect build speed.
Mistake: thinking containers are full VMs They are lighter and behave differently.
Mistake: not checking logs Logs often explain the problem.
Mistake: forgetting rebuilds If the image changed, rebuild it.

11) Quick quiz

Try this without looking back first.

Score: 0 / 5
1. What is a container?
A file that stores Docker instructions
A running instance created from an image
A website for downloading code
2. Which file defines how an image is built?
Dockerfile
container.txt
runtime.md
3. Which command shows running containers?
docker images
docker build
docker ps
4. What is Compose most useful for?
Editing code in the browser
Managing multi-container apps
Compressing images
5. Which command usually creates and starts a new container?
docker run
docker ps
docker logs

12) Practice tasks

Task 1 Install Docker on your operating system and run docker --version.
Task 2 Run docker run hello-world and explain what happened.
Task 3 Pull nginx, run it, and list your containers.
Task 4 Write a tiny Dockerfile for a Python or Node app.
Task 5 Build an image tagged myapp:1.0.
Task 6 Add a database service with Compose.
If you can install Docker, run hello-world, explain image vs container, write a basic Dockerfile, and say when to use Compose, you have crossed the beginner barrier.