0.2 · Installing Docker and running your first container

Fundamentals

0.2Installing Docker and running your first container

Goal: Install Docker on your workstation and run your first container with confidence.
Estimated time: 12 min · self-paced reading · If you only have 5 min: read “The essentials in 30s” + the diagram.

The essentials in 30 seconds

  • Docker Desktop on Windows/macOS, Docker Engine on Linux (+ Compose plugin): take the official packages.
  • docker version + docker compose version validate the installation; docker run hello-world validates end-to-end execution.
  • Remember the pull → run → ps trio: download, create + start, see — the whole guide replays it at large scale.

Running mini-case — Idir prepares his workstation in Algiers with no daemon conflict

Idir, junior DevOps in Algiers, prepares his Windows workstation: instead of stacking installers, he follows the ritual. He installs Docker Desktop from the official packages (with WSL 2 and virtualization enabled in the BIOS), checks with docker version and docker compose version, then runs docker run hello-world: the message displays — client, daemon, registry and execution work. He then lists with docker images and docker ps -a to read what just happened, then cleans up. His playground is ready, with no second engine in parallel.

Self-contained case for this section: it returns in the lesson, diagram, script and 48h challenge of section 0.2.

1. What needs installing?

On Windows and macOS, install Docker Desktop (interface + engine + Compose included). On Linux, install Docker Engine (official packages) then the Compose plugin. In all cases, check with docker version and docker compose version. Idir takes the official packages (docs.docker.com), never an exotic repository, and installs a single engine to avoid daemon conflicts.

2. The hello-world ritual

docker run hello-world downloads a tiny test image, creates a container, runs it (it prints a message) then ends it. If this message displays, everything works: the client talks to the daemon, the registry answers, execution works. Idir keeps hello-world as a regression test: on any future failure, he replays this ritual to isolate the problem.

3. Reading what just happened

docker images shows the downloaded image, docker ps -a the finished container. Remember the trio: pull (download), run (create + start), ps (see). The rest of the guide replays this trio at large scale. Idir reads his images and containers after each launch: seeing what you just did is the basic reflex.

Common misinterpretation: "I install two engines to compare, skip virtualization, and run unknown images from day one". No, triple fault. A single engine: two parallel daemons create conflicts. On Windows, WSL 2 + BIOS-enabled virtualization, otherwise the engine will not start. And start with hello-world, the minimal test image — not unknown images whose content you ignore.
Verified installation Install, check versions, run hello-world: the foundation is validated. Install Desktop/Engine Officialpackagesdocker version Installationprovendocker run hello-world Executionproven
Install, check versions, run hello-world: the foundation is validated.
Text version of the diagram (SEO / screen readers / translation): 1) Idir, junior DevOps in Algiers, installs the right official package: Docker Desktop on Windows/macOS (with WSL 2 and BIOS virtualization on Windows), Docker Engine + Compose plugin on Linux — a single engine, not two. 2) He checks the installation with docker version and docker compose version. 3) He validates execution with docker run hello-world (the tiny image downloads, the container prints its message then ends), then reads the result with docker images and docker ps -a. Lesson: this ritual is also the regression test to replay on every future failure.

🔎 Concrete example — 🔎 Concrete example — Full check

Idir validates his installation end to end with four commands.

docker version
docker compose version
docker run hello-world
docker ps -a

Reading: the first two commands prove the installation, the third proves execution, the last shows the finished container.

Lesson: on any future failure, replay this ritual to isolate the problem.

Section vocabulary

Docker Desktop
The all-in-one app (Windows/macOS): engine, Compose, interface.

Simple example: Idir installs it on his Windows with WSL 2.

What it is not: the command-line-only Linux engine.

Reflex: Windows/macOS → Desktop first.

Docker Engine
The engine on Linux: daemon + command-line client.

Simple example: Idir will later install it on his Linux server with the Compose plugin.

What it is not: the Desktop graphical interface.

Reflex: Linux → Engine + Compose plugin.

hello-world
The minimal test image that validates the installation.

Simple example: Idir runs it first and keeps the command as a regression test.

What it is not: an application image to keep in production.

Reflex: suspected failure → replay hello-world.

Daemon
The background service that actually runs containers.

Simple example: Idir understands his docker run hello-world was executed by the daemon.

What it is not: the command typed at the keyboard.

Reflex: engine that will not start → virtualization and daemon first.

Client
The docker command that talks to the daemon.

Simple example: Idir types docker version: the client questions the daemon.

What it is not: the service that runs containers.

Reflex: the client orders, the daemon executes.

In practice — In practice — Install and validate

  1. Install Docker Desktop (or Engine + Compose on Linux), like Idir, from the official packages.
  2. Run docker version and docker compose version.
  3. Run docker run hello-world and read the message.
  4. List images and containers (images, ps -a), then clean up.
Your workstation runs containers: the playground is ready.

Step-by-step script — install and validate like Idir (10 min)

1) Install the official package: Docker Desktop on Windows/macOS (enable WSL 2 + BIOS virtualization on Windows) or Engine + Compose plugin on Linux. 2) Type docker version then docker compose version: both answer. 3) Type docker run hello-world: read the validation message. 4) Type docker images then docker ps -a: spot the hello-world image and its finished container. 5) Clean up the test container and keep the sequence: it is your regression test.

If the engine will not start on Windows, check WSL 2 and virtualization before anything else.

Copy-paste template — my installation checklist

docker version
docker compose version
docker run hello-world
docker images
docker ps -a
# OK if: versions displayed + hello-world message + image and container listed.

Windows workstation

Idir on Windows: Docker Desktop + WSL 2 + BIOS-enabled virtualization, then the hello-world ritual.

macOS workstation

Idir's colleague on Mac: Docker Desktop, same four validation commands.

Linux server

Idir on Linux: Docker Engine via official packages + Compose plugin, same checks.

Future failure

The engine seems broken in a month: Idir replays docker run hello-world to isolate client, daemon, registry and execution.

✓ Best practices

  • Take the official packages (docs.docker.com), not exotic repositories.
  • Enable Docker Desktop startup if needed.
  • Keep hello-world as a regression test.

✗ Common pitfalls

  • Installing two engines in parallel (daemon conflicts).
  • Forgetting BIOS-enabled virtualization (Windows).
  • Running unknown images from day one.

Key takeaways

  • Desktop on Windows/macOS, Engine on Linux.
  • docker version validates the installation.
  • docker run hello-world validates execution.
  • pull → run → ps: the basic trio.

48h challenge — apply tomorrow

Run the template checklist on your workstation like Idir: install the official package, display both versions, run hello-world, then list with images and ps -a.

Section exit checklist
  • Docker is installed from the official packages (Desktop or Engine + Compose).
  • docker version and docker compose version answer.
  • docker run hello-world prints its message and I read the result with images and ps -a.
Self-assessment 1-5: can I say what each ritual command proves?Self-assessment 1-5: is my workstation ready and cleaned (single engine, test passed)?

Frequently asked questions

Is Docker Desktop free?

For personal use, learning and small organizations, yes. Large companies must check the subscription. On Linux, the engine stays free — so Idir learns without paying.

Is WSL 2 mandatory on Windows?

Yes, Docker Desktop relies on it: install WSL 2 and enable virtualization, otherwise the engine will not start. It is Idir's first check when Desktop refuses to launch.

Check your understanding

What does a "docker run hello-world" that prints its message prove?

Additional resources (optional, to go further)

Level 0 examFresh, harder questions to test what you've learned