Install Docker and verify prerequisites

10 min
Audience
beginner, Windows, macOS or Linux
Duration
20 to 30 min (plus the image download in lesson 04)
Module
1/7
Target skill
have a working Docker with enough memory, get the lab kit into a lab3 folder, recognize its file tree, run the prerequis checklist and know what to do when it shows a cross

The lab kit, to downloadhttps://github.com/hrhouma2/aiopsatlas-observabilite-labo-fr — with git clone https://github.com/hrhouma2/aiopsatlas-observabilite-labo-fr.git lab3. This lesson installs Docker (steps 1 to 3), gets this kit (step 4), tours it (step 5), then runs its checklist (step 6). The startup itself is in lesson 04.

In one image

A car's dashboard only lights up all green if the engine has enough fuel and the road ahead is clear. .\labo.ps1 prerequis (or ./labo.sh prerequis) plays that role before starting the observability stack: Docker is the engine, the allocated memory is the fuel, and the nine ports of the lab are the road that must be free. You only run demarrer (lesson 04) once this checklist ends with its green line: Tout est prêt. (everything is ready).

How it works

The lab is described in a docker-compose.yml file and driven by a script in two versions: labo.ps1 (PowerShell 5.1 or 7, Windows) and labo.sh (bash: Linux, macOS, WSL 2, Git Bash). You install nothing but Docker on your machine: Prometheus, Grafana, Loki, Alertmanager, Alloy, node-exporter, cAdvisor, the API, the load generator and the webhook all run in containers. Four of these images are built on your machine at first startup (api, charge, webhook from python:3.13-slim, and loki to add a health check binary to it); the other six are downloaded as they are.

SystemWhat you installMemory settingSpecial note
Windows 10/11Docker Desktop, WSL 2 enginefile %UserProfile%\.wslconfigSet-ExecutionPolicy if PowerShell refuses the script
macOSDocker Desktop (Intel or Apple Silicon)Settings → Resources → Memorynothing else; curl is already present
LinuxDocker Engine + docker-compose-plugin plugin + curlthe machine's RAM, directlydocker group; no kernel setting is needed

What prerequis checks, in order: the docker command exists; the Docker daemon answers; docker compose (v2) is available; curl is present (bash version only: labo.ps1 uses PowerShell's built-in commands); the memory visible to Docker is at least 2 GB (4 GB recommended: between 2 and 4, the script displays a warning but lets it through); at least two processors; and each of the nine lab ports is free, or already used by the lab itself.

PortServicePortServicePortService
9090Prometheus3100Loki8080cAdvisor
9093Alertmanager12345Alloy8000Catalog API
3000Grafana (GRAFANA_PORT)9100node-exporter8090webhook

Port 3000 is a special case. It is Grafana's, and it is the most requested port on a developer workstation: a Node application, another dashboard, another Grafana often already occupy it. The kit plans for this case with the GRAFANA_PORT environment variable. In docker-compose.yml, Grafana's port publishing reads:

yaml
    ports:
      - "${GRAFANA_PORT:-3000}:3000"

What to read: ${GRAFANA_PORT:-3000} is the variable if it is defined, 3000 otherwise. The right-hand part (:3000) is the port inside the container and never changes; the left-hand part is the port on your machine. The labo.ps1 and labo.sh scripts read the same variable: prerequis checks the right port, demarrer displays the right URL and etat queries Grafana at the right place. Documentation: Docker Compose — Interpolation.

Step by step

  1. Windows: install Docker Desktop with WSL 2. Download Docker Desktop, leave "Use WSL 2 instead of Hyper-V" checked, restart if asked, then launch Docker Desktop and wait for the whale icon to be stable. Under WSL 2, Docker takes half of your RAM by default; on an 8 GB machine, that is tight. To guarantee it 4 GB, create the file C:\Users\<you>\.wslconfig:

    powershell
    notepad $env:UserProfile\.wslconfig

    Paste these lines, save, then restart the WSL virtual machine:

    ini
    [wsl2]
    memory=4GB
    processors=4
    powershell
    wsl --shutdown

    Then relaunch Docker Desktop.

  2. macOS: install Docker Desktop and check the memory. Install the .dmg matching your chip, launch Docker Desktop, then open Settings → Resources → Advanced and check that the Memory slider is at 4 GB or more. Click "Apply & restart" if you changed it.

  3. Linux: Docker Engine, Compose plugin, curl and docker group. Install Docker Engine and the Compose plugin according to your distribution's documentation (packages docker-ce, docker-ce-cli, containerd.io, docker-compose-plugin), plus curl if it is missing. Then, to avoid typing sudo on every command:

    bash
    sudo usermod -aG docker $USER
    newgrp docker        # ou déconnecte-toi puis reconnecte-toi
    docker run --rm hello-world
  4. Get the lab kit.

    bash
    git clone https://github.com/hrhouma2/aiopsatlas-observabilite-labo-fr.git lab3
    cd lab3

    All the course commands are run from this lab3 folder. If you do not have git, the "Code → Download ZIP" button on the GitHub page gives the same content: unzip it and rename the folder to lab3.

  5. Tour the file tree. List the files (ls or Get-ChildItem -Recurse -File). On the course machine, the kit contains 32 files:

    text
    docker-compose.yml          les 10 services, leurs ports, leurs volumes, leurs healthchecks
    labo.ps1                    le script de pilotage, Windows
    labo.sh                     le même, bash
    README.md                   le mode d'emploi du kit
    LICENSE  .gitattributes  .gitignore
    api/app.py                  l'API catalogue (FastAPI + prometheus_client)
    api/donnees/cours.json      les 64 cours
    api/Dockerfile  api/requirements.txt
    charge/charge.py            le générateur de trafic
    charge/Dockerfile  charge/requirements.txt
    webhook/webhook.py          le récepteur d'alertes
    webhook/Dockerfile  webhook/requirements.txt
    prometheus/prometheus.yml   les 8 cibles, scrape toutes les 15 s
    prometheus/regles/alertes.yml         les 10 règles d'alerte
    prometheus/regles/enregistrement.yml  les règles d'enregistrement (api:taux_erreurs_5m…)
    alertmanager/alertmanager.yml         le routage vers le webhook
    loki/loki.yml  loki/Dockerfile
    alloy/config.alloy          la collecte des logs Docker → Loki
    grafana/provisioning/datasources/sources.yml       Prometheus, Loki, Alertmanager
    grafana/provisioning/dashboards/tableaux-de-bord.yml
    grafana/provisioning/dashboards/api-catalogue.json
    grafana/provisioning/dashboards/hote-conteneurs.json
    grafana/provisioning/dashboards/journaux-api.json
    modules/01-le-labo/requetes.txt        les requêtes PromQL de ce module
    modules/01-le-labo/requetes-logql.txt  les requêtes LogQL de ce module
    outils/generer-cours.py     le script qui a fabriqué cours.json

    What to see: one folder per service, and a modules/ folder where each module of the course stores its working files. You have nothing to modify before module 3.

  6. Run the checklist.

    powershell
    .\labo.ps1 prerequis
    bash
    ./labo.sh prerequis

    On the course machine (Windows 11, Docker Desktop, PowerShell 5.1), before the first startup:

    text
    
    == Prérequis ==
      ✔ docker : Docker version 29.3.1, build c2be9cc
      ✔ le démon Docker répond
      ✔ docker compose : 5.1.1
      ✔ mémoire disponible pour Docker : 31 Go
      ✔ processeurs : 20
      ✔ port 9090 libre
      ✔ port 9093 libre
      ✔ port 3000 libre
      ✔ port 3100 libre
      ✔ port 12345 libre
      ✔ port 9100 libre
      ✔ port 8080 libre
      ✔ port 8000 libre
      ✔ port 8090 libre
    
    Tout est prêt. Lancez : .\labo.ps1 demarrer

    What to see: fourteen check marks, and the last line green. Versions and memory depend on your machine. The bash version displays one more line, ✔ curl : présent, and ends with Lancez : ./labo.sh demarrer. Once the lab is started, rerunning prerequis displays port 9090 : utilisé par le labo lui-même (used by the lab itself) instead of libre (free): this is normal, and it is what you will see in lesson 04.

  7. If port 3000 is already taken: choose Grafana's port. Define GRAFANA_PORT before prerequis, and keep it defined for demarrer and etat:

    powershell
    $env:GRAFANA_PORT = 3001
    .\labo.ps1 prerequis
    bash
    GRAFANA_PORT=3001 ./labo.sh prerequis

    The checklist then displays ✔ port 3001 libre instead of the port 3000 line, and Grafana will answer on http://localhost:3001. All the course addresses mentioning port 3000 remain valid: replace 3000 with 3001. The variable only lives in the current terminal; if you open another terminal, define it again.

If it breaks

The messages below were genuinely triggered on the course machine.

  • Windows only — PowerShell refuses the script.

    text
    .\labo.ps1 : Impossible de charger le fichier C:\Users\<toi>\lab3\labo.ps1, car l'exécution de
    scripts est désactivée sur ce système. Pour plus d'informations, consultez about_Execution_Policies à l'adresse
    https://go.microsoft.com/fwlink/?LinkID=135170.
        + CategoryInfo          : Erreur de sécurité : (:) [], PSSecurityException
        + FullyQualifiedErrorId : UnauthorizedAccess

    Windows' default execution policy blocks unsigned scripts. Allow them for your account only:

    powershell
    Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

    Answer O (yes, oui) and rerun .\labo.ps1 prerequis. This is also what labo.ps1 displays when you launch it without an argument.

  • Docker is not installed, or the terminal was opened before the installation.

    text
    docker : Le terme «docker» n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script ou
    programme exécutable. Vérifiez l'orthographe du nom, ou si un chemin d'accès existe, vérifiez que le chemin d'accès
    est correct et réessayez.

    (docker: command not found under bash.) Close and reopen the terminal: the PATH has not been reloaded. If the message persists, Docker is not installed.

  • The daemon does not answer. prerequis displays a cross on le démon Docker répond (the Docker daemon answers). On Windows and macOS, Docker Desktop is not launched, or still starting: wait for the icon to be stable. Native Linux only — permission denied while trying to connect to the Docker daemon socket: your user is not in the docker group, or you did not log back in after usermod; id -nG must list docker.

  • Port 3000 is already occupied by another program. When the lab is not started yet and another program listens on Grafana's port, prerequis displays the cross and the remedy on the same line:

    text
      ✘ port 3000 déjà occupé par un autre programme — choisissez un autre port pour Grafana :  $env:GRAFANA_PORT = 3001  puis relancez
    
    Corrigez les points marqués ✘ puis relancez .\labo.ps1 prerequis

    Do what the line says (step 7). For another occupied port (9090, 8000…), the message is déjà occupé par un autre programme — arrêtez-le ou changez le port dans docker-compose.yml (already occupied by another program — stop it or change the port in docker-compose.yml): find the program (Get-NetTCPConnection -LocalPort 9090 on Windows, sudo ss -ltnp | grep 9090 on Linux) and stop it, or change the left-hand part of the port in docker-compose.yml ("9091:9090").

  • Windows only — not enough memory. ✘ mémoire pour Docker : 1 Go — il en faut au moins 2 (fichier %UserProfile%\.wslconfig : [wsl2] memory=4GB, puis wsl --shutdown) (memory for Docker: 1 GB — at least 2 needed). Do step 1. Between 2 and 4 GB, the script displays a warning instead of a cross and lets it through.

  • Git Bash on Windows — both scripts work. On the course machine, ./labo.sh prerequis launched from Git Bash gives the same list as labo.ps1, with the extra ✔ curl : présent line and the colors displayed. You can therefore follow the course's bash appendices on Windows if you prefer that terminal; the variable is then passed as on Linux: GRAFANA_PORT=3001 ./labo.sh prerequis.

To remember

This lab requires only one thing on your machine: Docker (Desktop or Engine, with the Compose plugin, and curl for the bash version); the ten services all run in containers, four of them built on your machine at first startup. Count on 2 GB of memory minimum for Docker, 4 GB recommended; on Windows, it is set in %UserProfile%\.wslconfig followed by wsl --shutdown. Nine ports must be free: 9090, 9093, 3000, 3100, 12345, 9100, 8080, 8000 and 8090. The kit is fetched with git clone https://github.com/hrhouma2/aiopsatlas-observabilite-labo-fr.git lab3, then cd lab3: 32 files, one folder per service, one modules/ folder for the course. .\labo.ps1 prerequis or ./labo.sh prerequis is your checklist: fourteen check marks (fifteen in bash) and Tout est prêt. before starting. If port 3000 is taken, GRAFANA_PORT=3001 moves Grafana without touching anything else; the variable must stay defined for prerequis, demarrer and etat. If PowerShell refuses the script: Set-ExecutionPolicy -Scope CurrentUser RemoteSigned.

To go further