0.2Installing Docker and running your first container
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.
🔎 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
- Install Docker Desktop (or Engine + Compose on Linux), like Idir, from the official packages.
- Run docker version and docker compose version.
- Run docker run hello-world and read the message.
- List images and containers (images, ps -a), then clean up.
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.
- 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.
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.
What does a "docker run hello-world" that prints its message prove?