Manuel Pratique · Édition 2026 Practical Manual · 2026 Edition

Apprendre Docker,
par la pratique.

Learn Docker,
the hands-on way.

Un guide complet, illustré et progressif pour exploiter le repository Fast-Docker. Douze laboratoires, des schémas, une cheatsheet, et un parcours pensé pour celles et ceux qui partent de zéro.

A complete, illustrated and progressive guide to make the most of the Fast-Docker repository. Twelve labs, diagrams, a cheatsheet, and a learning path designed for those starting from scratch.

Durée totale~ 8 à 12 heures
Laboratoires12 ateliers pratiques
NiveauDébutant → Intermédiaire
RepositoryJihatech/Fast-Docker
Total time~ 8 to 12 hours
Labs12 hands-on exercises
LevelBeginner → Intermediate
RepositoryJihatech/Fast-Docker
§ 01 — Introduction § 01 — Introduction

Pourquoi ce guide existe

Why this guide exists

Le repository Fast-Docker est une excellente base d'auto-formation, mais il s'adresse à des lecteurs qui savent déjà se repérer dans la documentation Docker. Ce guide accompagne pas à pas : il explique le pourquoi avant le comment, illustre les concepts par des schémas, et indique à chaque étape ce qu'il faut vérifier pour être sûr d'avoir compris.

The Fast-Docker repository is an excellent self-study foundation, but it speaks to readers already comfortable navigating Docker's documentation. This guide walks you through step by step: it explains the why before the how, illustrates concepts with diagrams, and tells you at each step what to verify to be sure you've understood.

À qui s'adresse ce manuel

Who this manual is for

  • Débutants complets qui ont entendu parler de Docker mais n'ont jamais lancé un conteneur.
  • Développeurs qui utilisent des images préparées par d'autres et veulent prendre le contrôle.
  • Administrateurs systèmes et SRE qui doivent industrialiser le déploiement d'applications.
  • Étudiants et stagiaires en cycle DevOps, infrastructure ou cybersécurité.
  • Architectes Cloud qui souhaitent consolider leurs fondamentaux avant d'aborder Kubernetes.
  • Complete beginners who have heard of Docker but have never launched a container.
  • Developers who use images prepared by others and want to take control.
  • System administrators and SREs who need to industrialize application deployments.
  • Students and interns in DevOps, infrastructure or cybersecurity tracks.
  • Cloud architects who want to solidify their fundamentals before tackling Kubernetes.

Ce que vous saurez faire à la fin

What you'll be able to do by the end

Construire
Vos images

Écrire un Dockerfile propre, multi-stage, sécurisé.

Orchestrer
Multi-services

Faire dialoguer plusieurs conteneurs avec Docker Compose.

Persister
Données & logs

Maîtriser volumes, bind mounts et stratégies de stockage.

Sécuriser
Production

Distroless, non-root, scan de vulnérabilités, healthchecks.

Build
Your images

Write clean, multi-stage, secure Dockerfiles.

Orchestrate
Multi-service

Have multiple containers talk to each other with Docker Compose.

Persist
Data & logs

Master volumes, bind mounts and storage strategies.

Secure
Production

Distroless, non-root, vulnerability scanning, healthchecks.

Comment lire ce guide

How to read this guide

Chaque laboratoire suit la même structure : un objectif énoncé en une phrase, une durée estimée, un schéma mental ou visuel, les commandes essentielles, les pièges classiques, et un critère de validation qui vous permet de savoir, sans ambiguïté, si vous avez compris.

Each lab follows the same structure: an objective stated in one sentence, an estimated duration, a mental or visual diagram, the essential commands, the classic pitfalls, and a validation criterion that lets you know, unambiguously, whether you've understood.

Lecture linéaire ou en zigzag : les douze laboratoires sont indépendants. Une recommandation d'ordre de progression est proposée au §4.

Linear or zigzag reading: the twelve labs are independent. A recommended progression order is proposed in §4.

§ 02 — Préparation § 02 — Setup

Prérequis et installation

Prerequisites and installation

Connaissances supposées

Assumed knowledge

Aucune connaissance préalable de Docker n'est nécessaire. Il faut simplement être à l'aise avec :

No prior Docker knowledge is required. You simply need to be comfortable with:

  • Un terminal (Bash sous Linux/macOS, PowerShell ou WSL2 sous Windows).
  • Les commandes de base : cd, ls, mkdir, cat, redirection >.
  • La notion de variable d'environnement et de port réseau.
  • Les bases de Git pour cloner le repository.
  • A terminal (Bash on Linux/macOS, PowerShell or WSL2 on Windows).
  • Basic commands: cd, ls, mkdir, cat, redirection >.
  • The notion of environment variable and network port.
  • The basics of Git to clone the repository.

Installer Docker

Install Docker

Linux (Ubuntu/Debian)

# Méthode officielle, en une commande
curl -fsSL https://get.docker.com | sh

# Ajouter votre utilisateur au groupe docker
sudo usermod -aG docker $USER
# Se déconnecter / reconnecter pour appliquer
# Official method, in one command
curl -fsSL https://get.docker.com | sh

# Add your user to the docker group
sudo usermod -aG docker $USER
# Log out / log back in to apply

macOS et Windows

macOS and Windows

Installer Docker Desktop depuis docker.com. Inclut le moteur, le CLI, Compose v2, BuildKit et une interface graphique.

Install Docker Desktop from docker.com. Includes the engine, CLI, Compose v2, BuildKit and a GUI.

Sous Windows, activer WSL2 au préalable (c'est l'option par défaut dans l'installeur).

On Windows, enable WSL2 beforehand (it's the default option in the installer).

Vérifier l'installation

Verify the installation

docker version            # client + daemon >= 24.x
docker compose version    # v2.x (avec espace, pas de tiret)
docker buildx version     # buildx présent par défaut
docker run hello-world    # test fonctionnel
docker version            # client + daemon >= 24.x
docker compose version    # v2.x (with space, no dash)
docker buildx version     # buildx ships by default
docker run hello-world    # functional test
Attention Si docker-compose (avec tiret) répond mais pas docker compose (avec espace), votre installation utilise la v1 dépréciée depuis juin 2023. Tous les exemples de ce guide utilisent la syntaxe v2.
Warning If docker-compose (with dash) responds but docker compose (with space) doesn't, your installation uses v1, deprecated since June 2023. All examples in this guide use v2 syntax.

Cloner le repository

Clone the repository

git clone https://github.com/Jihatech/Fast-Docker.git
cd Fast-Docker
ls -la

Outils complémentaires recommandés

Recommended additional tools

Aucun n'est obligatoire, mais ils enrichissent l'apprentissage.

None are mandatory, but they enrich the learning experience.

OutilRôleInstallation
diveInspecter les couches d'une imagebrew install dive
trivyScanner les vulnérabilitésbrew install trivy
hadolintLinter les Dockerfilebrew install hadolint
ctoptop-like pour conteneursbrew install ctop
lazydockerInterface terminal pour Dockerbrew install lazydocker
ToolRoleInstall
diveInspect an image's layersbrew install dive
trivyVulnerability scannerbrew install trivy
hadolintDockerfile linterbrew install hadolint
ctoptop-like for containersbrew install ctop
lazydockerTerminal UI for Dockerbrew install lazydocker
§ 03 — Théorie § 03 — Theory

Les concepts qu'il faut comprendre avant de pratiquer

The concepts to grasp before practicing

Cinq notions structurent toute l'expérience Docker : l'architecture client/serveur, le cycle de vie du conteneur, le système de couches, les volumes, et les réseaux. En les visualisant correctement, l'essentiel des commandes deviennent évidentes.

Five notions structure the entire Docker experience: client/server architecture, container lifecycle, the layer system, volumes, and networks. With these clearly in mind, most commands become obvious.

Architecture Docker

Docker architecture

Docker est un système client / serveur. Quand vous tapez docker run dans votre terminal, vous parlez à un client. Ce client envoie une requête à un daemon (le serveur), qui se charge réellement de créer l'image, de lancer le conteneur, et de communiquer avec le registry où sont stockées les images publiées.

Docker is a client / server system. When you type docker run in your terminal, you talk to a client. That client sends a request to a daemon (the server), which actually does the work of creating the image, running the container, and communicating with the registry where published images are stored.

CLIENT docker CLI votre terminal your terminal DOCKER HOST Docker Daemon (dockerd) REST API · containerd · runc Images read-only Containers running VOLUMES NETWORKS REGISTRY Docker Hub ECR · ACR · GCR Harbor · Nexus REST pull/push
Schéma 1. Architecture client / daemon / registry. Le CLI ne fait jamais le travail lui-même — il envoie des requêtes au daemon via une API REST locale.
Diagram 1. Client / daemon / registry architecture. The CLI never does the work itself — it sends requests to the daemon via a local REST API.
Client
docker

L'exécutable que vous lancez dans votre terminal. Il traduit vos commandes en appels API.

Daemon
dockerd

Le processus qui tourne en arrière-plan et fait réellement le travail : build, run, network, volumes.

Registry
Docker Hub & co

Bibliothèque distante où les images sont publiées et téléchargées.

Client
docker

The executable you run in your terminal. It translates your commands into API calls.

Daemon
dockerd

The background process that actually does the work: build, run, network, volumes.

Registry
Docker Hub & co

Remote library where images are published and downloaded from.

Cycle de vie d'un conteneur

Container lifecycle

Un conteneur n'a que cinq états possibles. Comprendre les transitions entre ces états élimine 90% des confusions de débutant — notamment la différence entre une image (modèle), un conteneur arrêté (instance gelée) et un conteneur actif (processus en cours).

A container has only five possible states. Understanding the transitions between them removes 90% of beginner confusion — especially the difference between an image (template), a stopped container (frozen instance) and a running container (live process).

Image pulled Created not started Running active Paused Stopped Removed create start pause unpause stop start rm docker pull docker create docker run = create + start
Schéma 2. Les cinq états d'un conteneur. La commande docker run regroupe en réalité create et start.
Diagram 2. The five container states. The docker run command actually combines create and start.

Couches d'image (Union File System)

Image layers (Union File System)

Une image Docker n'est pas un fichier monolithique. C'est un empilement de couches en lecture seule, chaque instruction du Dockerfile (FROM, RUN, COPY...) produisant une couche. Lorsqu'un conteneur démarre, Docker ajoute par-dessus une couche fine en lecture-écriture. Toutes les modifications faites pendant l'exécution se trouvent dans cette couche éphémère.

A Docker image isn't a monolithic file. It's a stack of read-only layers, each Dockerfile instruction (FROM, RUN, COPY…) producing a layer. When a container starts, Docker adds a thin read-write layer on top. All modifications made during execution land in this ephemeral layer.

IMAGE (read-only) FROM ubuntu:22.04 RUN apt install python3 RUN pip install ... COPY . /app layer 1 → layer N CONTAINER (read-write) FROM ubuntu:22.04 RUN apt install python3 RUN pip install ... COPY . /app writable layer supprimée à la destruction destroyed when container removed docker run
Schéma 3. Le système de couches Union File System. Plusieurs conteneurs peuvent partager les mêmes couches en lecture seule, n'occupant que l'espace de leur couche d'écriture.
Diagram 3. The Union File System layer model. Multiple containers can share the same read-only layers, only consuming space for their writable layer.
Conséquence pratique Toute donnée écrite dans un conteneur est perdue à sa destruction. Pour persister (logs, base de données, fichiers utilisateur), il faut utiliser un volume ou un bind mount — voir LAB 02.
Practical consequence Any data written to a container is lost when it's destroyed. To persist (logs, databases, user files), use a volume or a bind mount — see LAB 02.

Modes réseau

Network modes

Docker propose cinq pilotes réseau, chacun adapté à un cas d'usage précis. Le choix par défaut, bridge, convient à la majorité des situations en mono-machine. Host supprime l'isolation réseau pour gagner en performance. Overlay permet à des conteneurs sur des machines différentes de se voir comme s'ils étaient en local.

Docker offers five network drivers, each suited to a specific use case. The default, bridge, fits most single-machine situations. Host removes network isolation for performance. Overlay lets containers on different machines see each other as if they were local.

bridge (défaut) bridge (default) docker0 bridge c1 c2 host network host container utilise uses le host direct the host directly aucune isolation réseau no network isolation overlay (multi-host) c1 c2 host A host B overlay tunnel Swarm / Kubernetes
Schéma 4. Trois pilotes réseau. bridge est le défaut local, host supprime l'isolation, overlay connecte plusieurs machines.
Diagram 4. Three network drivers. bridge is the local default, host removes isolation, overlay connects multiple machines.

Comprendre l'image, le conteneur et le volume, c'est tenir 80% de Docker. Le reste n'est qu'orchestration et ergonomie.

Understand image, container and volume, and you've got 80% of Docker. The rest is just orchestration and ergonomics.

§ 04 — Méthode § 04 — Method

Parcours d'apprentissage recommandé

Recommended learning path

Les douze laboratoires du repository peuvent être abordés dans n'importe quel ordre, mais l'expérience montre qu'une progression réfléchie évite frustrations et oublis. Voici trois parcours selon votre point de départ.

The repository's twelve labs can be tackled in any order, but experience shows that a thoughtful progression avoids frustration and gaps. Here are three paths depending on your starting point.

Parcours A · Découverte complète (recommandé)

Path A · Full discovery (recommended)

Pour qui n'a jamais touché Docker. Compter 8 à 12 heures réparties sur 2 à 3 semaines.

For someone who has never touched Docker. Plan for 8 to 12 hours spread across 2 to 3 weeks.

OrdreLabPourquoi à ce momentDurée
1LAB 01 — Premier conteneurPoser les bases : build, run, exec, logs, rm45 min
2LAB 06 — TransfertsDébugger, copier des fichiers entre conteneur et hôte20 min
3LAB 02 — VolumesPersister la donnée (sinon tout est perdu)45 min
4LAB 12 — HealthchecksPratique production souvent oubliée30 min
5LAB 03 — ComposeOrchestrer plusieurs services1 h
6LAB 09 — ConfigurationMaîtriser le daemon, proxy, registry mirrors30 min
7LAB 05 — RegistryPublier ses propres images45 min
8LAB 07 — Build LinuxMulti-stage build (concept clé)45 min
9LAB 11 — SécuritéDistroless, non-root, scan1 h
10LAB 10 — Multi-archCompatibilité ARM/AMD6445 min
11LAB 04 — Swarm legacyLecture culturelle, passerelle vers K8s30 min
12LAB 08 — Build WindowsOptionnel, niche Windows uniquement30 min
OrderLabWhy at this pointDuration
1LAB 01 — First containerLay the basics: build, run, exec, logs, rm45 min
2LAB 06 — TransfersDebug, copy files between container and host20 min
3LAB 02 — VolumesPersist data (otherwise everything is lost)45 min
4LAB 12 — HealthchecksProduction practice often forgotten30 min
5LAB 03 — ComposeOrchestrate multiple services1 h
6LAB 09 — ConfigurationMaster the daemon, proxy, registry mirrors30 min
7LAB 05 — RegistryPublish your own images45 min
8LAB 07 — Linux buildMulti-stage build (key concept)45 min
9LAB 11 — SecurityDistroless, non-root, scan1 h
10LAB 10 — Multi-archARM/AMD64 compatibility45 min
11LAB 04 — Swarm legacyCultural read, gateway to K8s30 min
12LAB 08 — Windows buildOptional, Windows niche only30 min

Parcours B · Express (4 heures, l'essentiel)

Path B · Express (4 hours, the essentials)

Pour qui veut comprendre Docker rapidement avant un projet ou un entretien.

For someone who wants to understand Docker quickly before a project or interview.

  • LAB 01 → LAB 02 → LAB 03 → LAB 11 → LAB 12

Parcours C · Préparation Kubernetes / CKA

Path C · Kubernetes / CKA preparation

Pour qui prépare une certification CKA, CKAD ou CKS.

For someone preparing for a CKA, CKAD or CKS certification.

  • LAB 01 → LAB 02 → LAB 11 → LAB 12 → §7 (pont vers Kubernetes)
  • Sauter LAB 04 (Swarm est hors syllabus CKA)
  • LAB 01 → LAB 02 → LAB 11 → LAB 12 → §7 (bridge to Kubernetes)
  • Skip LAB 04 (Swarm is out of the CKA syllabus)

Méthode de session efficace

Effective session method

Une session de 90 minutes bien structurée vaut mieux que trois heures dispersées :

A well-structured 90-minute session beats three scattered hours:

  • 10 min — relire la section théorique correspondante du README.
  • 50 min — exécuter le lab, puis introduire des variations volontaires (changer une image, casser un truc, réparer).
  • 15 min — prendre des notes personnelles (un fichier notes/LABxx.md dans votre fork).
  • 15 min — formuler une question ouverte qui reste en suspens. Ouvrir une issue dans votre fork pour la traiter plus tard.
  • 10 min — re-read the corresponding theory section in the README.
  • 50 min — run the lab, then introduce deliberate variations (change an image, break something, fix it).
  • 15 min — take personal notes (a notes/LABxx.md file in your fork).
  • 15 min — formulate one open question that remains unanswered. Open an issue in your fork to address it later.
§ 05 — Pratique § 05 — Practice

Les douze laboratoires

The twelve labs

Chaque lab est conçu pour être autonome. Faites-les un par un, exécutez chaque commande, et ne passez à la suite que lorsque le critère de validation est rempli.

Each lab is designed to be self-contained. Do them one by one, run every command, and only move on once the validation criterion is met.

01

Premier conteneur — Image, build, run

First container — Image, build, run

Durée 45 min Niveau Débutant Source LAB01-FirstImageFirstContainer.md
Duration 45 min Level Beginner Source LAB01-FirstImageFirstContainer.md

Objectif

Goal

Construire votre première image Docker depuis un Dockerfile, lancer un conteneur, comprendre le cycle build → run → exec → stop → rm.

Build your first Docker image from a Dockerfile, run a container, understand the build → run → exec → stop → rm cycle.

Concepts couverts

Concepts covered

  • Anatomie d'un Dockerfile (FROM, WORKDIR, COPY, RUN, CMD)
  • Différence entre image build et container run
  • Inspection d'un conteneur en cours d'exécution
  • Anatomy of a Dockerfile (FROM, WORKDIR, COPY, RUN, CMD)
  • Difference between image build and container run
  • Inspecting a running container

Commandes essentielles

Essential commands

# 1. Construire l'image depuis un Dockerfile
docker image build -t hello .

# 2. Lancer un conteneur
docker container run -d --name c1 hello

# 3. Inspecter
docker container ls
docker container logs c1
docker container exec -it c1 sh

# 4. Nettoyer
docker container rm -f c1
docker image rm hello
# 1. Build the image from a Dockerfile
docker image build -t hello .

# 2. Run a container
docker container run -d --name c1 hello

# 3. Inspect
docker container ls
docker container logs c1
docker container exec -it c1 sh

# 4. Clean up
docker container rm -f c1
docker image rm hello

Pièges classiques

Common pitfalls

  • Le fichier doit s'appeler exactement Dockerfile, sans extension.
  • Confusion CMD vs ENTRYPOINT : CMD est surchargeable au run, ENTRYPOINT non.
  • docker run est un raccourci de create + start. Comprendre cette décomposition aide pour le débogage.
  • The file must be named exactly Dockerfile, no extension.
  • CMD vs ENTRYPOINT confusion: CMD can be overridden at run, ENTRYPOINT cannot.
  • docker run is a shortcut for create + start. Knowing this decomposition helps when debugging.
Validation Vous pouvez décrire en trois phrases ce qui se passe entre docker build et l'apparition d'un conteneur en état Running. Vous savez expliquer pourquoi docker run hello et docker create hello + docker start donnent le même résultat.
Validation You can describe in three sentences what happens between docker build and a container appearing in the Running state. You can explain why docker run hello and docker create hello + docker start produce the same result.
02

Volumes et bind mounts — Persister la donnée

Volumes and bind mounts — Persist data

Durée 45 min Niveau Débutant Source LAB02-DockerVolume.md
Duration 45 min Level Beginner Source LAB02-DockerVolume.md

Objectif

Goal

Persister la donnée hors du cycle de vie du conteneur. Sans volume, toute écriture est perdue à la destruction.

Persist data outside the container's lifecycle. Without a volume, every write is lost on destruction.

VOLUME (géré par Docker) VOLUME (managed by Docker) /var/lib/docker/volumes/ container volume mount portable, recommandé en prod portable, recommended in prod backup, migration faciles easy backup, migration BIND MOUNT (chemin host) BIND MOUNT (host path) /home/user/projet/ container /home/dev mount utile en dev (hot reload) useful in dev (hot reload) couplage host, pièges en prod host coupling, pitfalls in prod
Schéma 5. Volume nommé vs bind mount. Le volume est portable et géré par Docker ; le bind mount couple un chemin précis du système hôte.
Diagram 5. Named volume vs bind mount. The volume is portable and managed by Docker; the bind mount couples to a specific host path.

Commandes essentielles

Essential commands

# Volume nommé
docker volume create data
docker run -v data:/app alpine sh -c "echo hello > /app/file.txt"
docker run -v data:/app alpine cat /app/file.txt
# => hello (donnée persistée)

# Bind mount
docker run -v $(pwd)/local:/app alpine ls /app

# Inspection
docker volume ls
docker volume inspect data
# Named volume
docker volume create data
docker run -v data:/app alpine sh -c "echo hello > /app/file.txt"
docker run -v data:/app alpine cat /app/file.txt
# => hello (data persisted)

# Bind mount
docker run -v $(pwd)/local:/app alpine ls /app

# Inspection
docker volume ls
docker volume inspect data

Quand utiliser quoi

When to use what

TypeCas d'usageExemple
Volume nomméProduction, données applicativesBase de données MySQL
Bind mountDéveloppement, hot reloadCode source d'une app web en dev
tmpfsSecrets éphémères, cacheTokens d'auth temporaires
TypeUse caseExample
Named volumeProduction, application dataMySQL database
Bind mountDevelopment, hot reloadSource code of a web app in dev
tmpfsEphemeral secrets, cacheTemporary auth tokens
Validation Vous savez expliquer la différence entre volume nommé, bind mount et tmpfs. Vous comprenez pourquoi un bind mount peut se comporter différemment sur Linux et Windows/WSL2 (différences de système de fichiers et de permissions).
Validation You can explain the difference between named volume, bind mount and tmpfs. You understand why a bind mount may behave differently on Linux versus Windows/WSL2 (filesystem and permission differences).
03

Docker Compose v2 — WordPress et MySQL

Docker Compose v2 — WordPress and MySQL

Durée 1 h Niveau Débutant Source LAB03-DockerCompose.md
Duration 1 h Level Beginner Source LAB03-DockerCompose.md

Objectif

Goal

Orchestrer plusieurs conteneurs avec dépendances et réseau dédié, via un fichier compose.yml déclaratif. C'est le passage du jouet (un conteneur) au réel (une application complète).

Orchestrate multiple containers with dependencies and a dedicated network via a declarative compose.yml file. This is the move from toy (one container) to real (a full application).

Compose en une image

Compose in one picture

network: mynet wordpress port 80:80 mysql depends_on: healthy mydata volume
Schéma 6. Une stack Compose typique : services connectés à un même réseau, volume dédié pour la persistance, dépendance santé entre services.
Diagram 6. A typical Compose stack: services connected to a shared network, dedicated volume for persistence, health-based dependency between services.

Fichier compose.yml moderne (2026)

Modern compose.yml (2026)

# Pas de "version:" — obsolète en Compose v2
services:
  db:
    image: mysql:8.0
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_DATABASE: wordpress
    volumes:
      - mydata:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      interval: 10s
      retries: 5

  wordpress:
    image: wordpress:latest
    depends_on:
      db:
        condition: service_healthy
    ports:
      - "8080:80"
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_PASSWORD: secret

volumes:
  mydata:
# No "version:" — obsolete in Compose v2
services:
  db:
    image: mysql:8.0
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_DATABASE: wordpress
    volumes:
      - mydata:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      interval: 10s
      retries: 5

  wordpress:
    image: wordpress:latest
    depends_on:
      db:
        condition: service_healthy
    ports:
      - "8080:80"
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_PASSWORD: secret

volumes:
  mydata:

Commandes essentielles

Essential commands

docker compose up -d         # lancer en arrière-plan
docker compose ps            # lister
docker compose logs -f       # suivre les logs
docker compose down          # arrêter
docker compose down -v       # arrêter + supprimer volumes
docker compose up -d         # launch in background
docker compose ps            # list
docker compose logs -f       # follow logs
docker compose down          # stop
docker compose down -v       # stop + remove volumes

Pièges classiques

Common pitfalls

  • Le champ version: est obsolète en Compose v2. Commencer directement par services:.
  • docker-compose (avec tiret) = v1 dépréciée. Utiliser docker compose (avec espace).
  • depends_on sans condition ne garantit que le démarrage, pas que le service est prêt. Toujours coupler à un healthcheck pour les bases de données.
  • Ne jamais commit un compose.yml avec des mots de passe en clair. Utiliser un fichier .env ignoré par Git.
  • The version: field is obsolete in Compose v2. Start directly with services:.
  • docker-compose (with dash) = deprecated v1. Use docker compose (with space).
  • depends_on without condition only guarantees startup order, not that the service is ready. Always pair with a healthcheck for databases.
  • Never commit a compose.yml with plaintext passwords. Use a .env file ignored by Git.
Validation Vous écrivez de zéro un compose.yml à 2 services avec healthcheck, démarrage ordonné et volume nommé, sans copier l'exemple.
Validation You write a 2-service compose.yml from scratch with healthcheck, ordered startup and a named volume, without copying the example.
04

Docker Swarm — Stack et services legacy

Docker Swarm — Stack and services legacy

Durée 30 min (lecture) Niveau Intermédiaire Source LAB04-DockerStackService.md
Duration 30 min (reading) Level Intermediate Source LAB04-DockerStackService.md

Statut

Status

Note Docker Swarm est en maintenance depuis 2020. L'industrie a massivement adopté Kubernetes pour l'orchestration en production. Ce lab garde une valeur pédagogique pour comprendre les concepts d'orchestration, mais ne pas l'utiliser pour de nouveaux projets.
Note Docker Swarm has been in maintenance mode since 2020. The industry massively adopted Kubernetes for production orchestration. This lab retains pedagogical value for understanding orchestration concepts, but should not be used for new projects.

Concepts qui transposent vers Kubernetes

Concepts that transpose to Kubernetes

Le vocabulaire Swarm prépare directement à Kubernetes. Pour chaque commande, son équivalent K8s :

The Swarm vocabulary directly prepares for Kubernetes. For each command, its K8s equivalent:

SwarmKubernetesConcept
service createDeployment + ServiceWorkload répliqué
service scalekubectl scale deploymentMise à l'échelle
service update --imagekubectl set imageRolling update
service rollbackkubectl rollout undoRetour arrière
stackHelm chartMulti-services packagés
overlay networkCNI pluginRéseau multi-host
SwarmKubernetesConcept
service createDeployment + ServiceReplicated workload
service scalekubectl scale deploymentScaling
service update --imagekubectl set imageRolling update
service rollbackkubectl rollout undoRollback
stackHelm chartMulti-service packaging
overlay networkCNI pluginMulti-host network

Si vous voulez quand même tester

If you want to try it anyway

docker swarm init
docker service create --name web --replicas 3 -p 8080:80 nginx
docker service ls
docker service scale web=5
docker service update --image nginx:1.25 web
docker service rollback web
docker swarm leave --force
05

Registry local — Publier ses images

Local registry — Publish your images

Durée 45 min Niveau Intermédiaire Source LAB05-DockerLocalRegistry.md
Duration 45 min Level Intermediate Source LAB05-DockerLocalRegistry.md

Objectif

Goal

Faire tourner votre propre registry, tagger une image, la pousser, la récupérer. Comprendre la chaîne build → tag → push → pull.

Run your own registry, tag an image, push it, pull it. Understand the build → tag → push → pull chain.

Vocabulaire à maîtriser

Vocabulary to master

  • Repository : un nom (ex. nginx) qui regroupe plusieurs versions.
  • Image : une version spécifique dans un repository.
  • Tag : un alias humain (:1.25, :latest).
  • Digest : empreinte SHA-256 immuable (@sha256:abc...).
  • Manifest : description JSON d'une image (couches, plateforme).
  • Repository: a name (e.g. nginx) that groups multiple versions.
  • Image: a specific version inside a repository.
  • Tag: a human alias (:1.25, :latest).
  • Digest: an immutable SHA-256 fingerprint (@sha256:abc...).
  • Manifest: JSON description of an image (layers, platform).

Commandes essentielles

Essential commands

# Lancer un registry local
docker run -d -p 5000:5000 --name registry registry:2

# Tagger une image pour le registry local
docker tag hello localhost:5000/hello:v1

# Pousser
docker push localhost:5000/hello:v1

# Lister via l'API
curl http://localhost:5000/v2/_catalog
curl http://localhost:5000/v2/hello/tags/list

# Récupérer depuis le registry
docker pull localhost:5000/hello:v1
# Run a local registry
docker run -d -p 5000:5000 --name registry registry:2

# Tag an image for the local registry
docker tag hello localhost:5000/hello:v1

# Push
docker push localhost:5000/hello:v1

# List via the API
curl http://localhost:5000/v2/_catalog
curl http://localhost:5000/v2/hello/tags/list

# Pull from the registry
docker pull localhost:5000/hello:v1
En production Le registry registry:2 ne fait ni authentification, ni RBAC, ni scan de vulnérabilités. En entreprise, on utilise Harbor (open source), ou les registries managés cloud : ECR (AWS), ACR (Azure), GCR (Google), Artifactory ou Nexus.
In production The registry:2 registry has no authentication, no RBAC, no vulnerability scanning. In enterprise, use Harbor (open source), or managed cloud registries: ECR (AWS), ACR (Azure), GCR (Google), Artifactory or Nexus.

Pourquoi ne pas tagger :latest en production

Why not tag :latest in production

Le tag latest n'a aucune signification stable : il pointe à un instant T sur ce que le mainteneur considère comme la dernière version. Demain, il peut pointer ailleurs. Cela rend les déploiements non reproductibles. Toujours utiliser une version explicite (:1.25.3) ou un digest pour les builds critiques.

The latest tag has no stable meaning: at any given moment it points to whatever the maintainer considers the latest version. Tomorrow, it may point elsewhere. This makes deployments non-reproducible. Always use an explicit version (:1.25.3) or a digest for critical builds.

Validation Vous expliquez à un collègue la différence entre repository, image, tag et digest. Vous savez pourquoi :latest en production est une faute professionnelle.
Validation You can explain to a colleague the difference between repository, image, tag and digest. You know why :latest in production is a professional mistake.
06

Transferts hôte ↔ conteneur

Host ↔ container transfers

Durée 20 min Niveau Débutant Source LAB06-DockerTransferringContent.md
Duration 20 min Level Beginner Source LAB06-DockerTransferringContent.md

Objectif

Goal

Copier des fichiers entre la machine hôte et un conteneur, en complément des volumes. Utile pour le débogage et l'extraction de logs ponctuelle.

Copy files between the host and a container, complementing volumes. Useful for debugging and one-off log extraction.

Commandes essentielles

Essential commands

# Copier un fichier vers le conteneur
docker cp ./config.json mycontainer:/etc/app/

# Récupérer un fichier depuis le conteneur
docker cp mycontainer:/var/log/app.log ./

# Récupérer un dossier complet
docker cp mycontainer:/etc/nginx ./nginx-backup
# Copy a file to the container
docker cp ./config.json mycontainer:/etc/app/

# Pull a file from the container
docker cp mycontainer:/var/log/app.log ./

# Pull a whole directory
docker cp mycontainer:/etc/nginx ./nginx-backup

Quand utiliser quoi

When to use what

  • Débogage ponctuel, extraction d'un fichier de log → docker cp.
  • Échanges réguliers, configuration partagée → volume ou bind mount.
  • One-off debugging, extracting a log file → docker cp.
  • Regular exchanges, shared configuration → volume or bind mount.
Astuce docker cp fonctionne même sur un conteneur arrêté. Très utile pour récupérer un état post-mortem après un crash.
Tip docker cp works even on a stopped container. Very useful for retrieving post-mortem state after a crash.
07

Build C++ Linux — Multi-stage en pratique

C++ Linux build — Multi-stage in practice

Durée 45 min Niveau Intermédiaire Source LAB07-DockerfileForLinuxC++Build.md
Duration 45 min Level Intermediate Source LAB07-DockerfileForLinuxC++Build.md

Objectif

Goal

Le langage importe peu — l'enjeu est le multi-stage build : compiler dans une image lourde (avec compilateur, dépendances de build), puis copier le binaire produit dans une image légère pour l'exécution.

The language doesn't matter much — the point is the multi-stage build: compile in a heavy image (with compiler, build deps), then copy the produced binary into a lightweight image for execution.

Stage 1 — builder FROM gcc:13 RUN make ~ 800 MB COPY --from=builder /app/binary /app Stage 2 — runtime FROM debian:slim ~ 80 MB
Schéma 7. Multi-stage build : on compile dans un environnement riche, on n'embarque que le strict nécessaire dans l'image finale. Réduction typique de taille : 5× à 20×.
Diagram 7. Multi-stage build: compile in a rich environment, ship only the strict minimum in the final image. Typical size reduction: 5× to 20×.

Pattern à mémoriser (universel, applicable à Go, Java, Node, Rust)

Pattern to memorize (universal, applies to Go, Java, Node, Rust)

# Stage 1 : build
FROM golang:1.22 AS builder
WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 go build -o /app

# Stage 2 : runtime minimaliste
FROM gcr.io/distroless/static-debian12
COPY --from=builder /app /app
USER 65532
ENTRYPOINT ["/app"]
# Stage 1: build
FROM golang:1.22 AS builder
WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 go build -o /app

# Stage 2: minimal runtime
FROM gcr.io/distroless/static-debian12
COPY --from=builder /app /app
USER 65532
ENTRYPOINT ["/app"]
Validation Vous écrivez un multi-stage Dockerfile pour un langage compilé de votre choix, et l'image finale fait au moins 5× moins que l'image de build.
Validation You write a multi-stage Dockerfile for a compiled language of your choice, and the final image is at least 5× smaller than the build image.
08

Build C++ Windows — Conteneurs Windows

C++ Windows build — Windows containers

Durée 30 min Niveau Avancé / niche Source LAB08-DockerfileForWindowsC++Build.md
Duration 30 min Level Advanced / niche Source LAB08-DockerfileForWindowsC++Build.md

Objectif

Goal

Découvrir les conteneurs Windows, basés sur Windows Server Core ou Nano Server. Cas d'usage spécifique : applications .NET Framework historiques, services Windows, build IIS.

Discover Windows containers, based on Windows Server Core or Nano Server. Specific use cases: legacy .NET Framework applications, Windows services, IIS builds.

Compatibilité Les conteneurs Windows ne tournent que sur Windows. Sur Linux et macOS, on ne peut pas les exécuter (ou alors via une VM Windows complète, ce qui défait l'intérêt).
Compatibility Windows containers only run on Windows. On Linux and macOS, you can't execute them (or only via a full Windows VM, which defeats the purpose).

Particularités

Specifics

  • Images de base : mcr.microsoft.com/windows/servercore, mcr.microsoft.com/windows/nanoserver.
  • Tailles colossales (1 à 5 Go contre 5 à 100 Mo pour Linux).
  • Le moteur Docker doit être basculé en mode Windows containers dans Docker Desktop.
  • Base images: mcr.microsoft.com/windows/servercore, mcr.microsoft.com/windows/nanoserver.
  • Massive sizes (1 to 5 GB versus 5 to 100 MB for Linux).
  • The Docker engine must be switched to Windows containers mode in Docker Desktop.

Pour la majorité des lecteurs, ce lab est optionnel. À ne pratiquer que si votre métier vous y confronte (.NET Framework legacy, applications Windows à containeriser).

For most readers, this lab is optional. Only worth doing if your work requires it (legacy .NET Framework, Windows applications to containerize).

09

Configuration du daemon — Proxy, registries, logs

Daemon configuration — Proxy, registries, logs

Durée 30 min Niveau Intermédiaire Source LAB09-DockerConfiguration.md
Duration 30 min Level Intermediate Source LAB09-DockerConfiguration.md

Objectif

Goal

Maîtriser /etc/docker/daemon.json (Linux) ou les paramètres Docker Desktop pour gérer proxies d'entreprise, registries miroirs, et limiter la croissance des logs.

Master /etc/docker/daemon.json (Linux) or Docker Desktop settings to manage corporate proxies, mirror registries, and limit log growth.

Exemple complet de daemon.json

Complete daemon.json example

{
  "insecure-registries": ["registry.local:5000"],
  "registry-mirrors": ["https://mirror.gcr.io"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  },
  "default-runtime": "runc",
  "live-restore": true
}

Proxy d'entreprise (Linux)

Corporate proxy (Linux)

Configuration via systemd (/etc/systemd/system/docker.service.d/http-proxy.conf) :

Configuration via systemd (/etc/systemd/system/docker.service.d/http-proxy.conf):

[Service]
Environment="HTTP_PROXY=http://proxy.corp:3128"
Environment="HTTPS_PROXY=http://proxy.corp:3128"
Environment="NO_PROXY=localhost,127.0.0.1,.corp.local"
sudo systemctl daemon-reload
sudo systemctl restart docker
Piège classique Sans log-opts, les logs s'accumulent indéfiniment dans /var/lib/docker/containers/.../*-json.log. Sur un serveur qui tourne longtemps, ça remplit silencieusement le disque.
Common pitfall Without log-opts, logs accumulate indefinitely in /var/lib/docker/containers/.../*-json.log. On a long-running server, this silently fills the disk.
10

Multi-platform builds — ARM et AMD64 2024+

Multi-platform builds — ARM and AMD64 2024+

Durée 45 min Niveau Intermédiaire Source LAB10-MultiPlatformBuilds.md
Duration 45 min Level Intermediate Source LAB10-MultiPlatformBuilds.md

Objectif

Goal

Produire une image qui tourne sur plusieurs architectures avec une seule commande de build. Indispensable depuis l'arrivée d'Apple Silicon (M1/M2/M3) et la généralisation d'AWS Graviton et Raspberry Pi en production.

Produce an image that runs on multiple architectures with a single build command. Essential since the arrival of Apple Silicon (M1/M2/M3) and the spread of AWS Graviton and Raspberry Pi in production.

Pourquoi c'est devenu critique

Why this became critical

  • Apple Silicon (ARM64) sur les laptops développeurs.
  • AWS Graviton (ARM64) à 20% moins cher que x86 chez AWS.
  • Raspberry Pi et edge computing.
  • Les images amd64-only ne tournent plus de manière performante sur ces machines.
  • Apple Silicon (ARM64) on developer laptops.
  • AWS Graviton (ARM64) is 20% cheaper than x86 on AWS.
  • Raspberry Pi and edge computing.
  • amd64-only images no longer run efficiently on these machines.

Setup buildx et build multi-arch

buildx setup and multi-arch build

# Créer un builder dédié
docker buildx create --name multi --use
docker buildx inspect --bootstrap

# Build pour deux architectures et push direct
docker buildx build \
  --platform linux/amd64,linux/arm64 \
  -t myrepo/myapp:1.0 \
  --push .

# Vérifier le manifest multi-arch
docker manifest inspect myrepo/myapp:1.0
# Create a dedicated builder
docker buildx create --name multi --use
docker buildx inspect --bootstrap

# Build for two architectures and push directly
docker buildx build \
  --platform linux/amd64,linux/arm64 \
  -t myrepo/myapp:1.0 \
  --push .

# Verify the multi-arch manifest
docker manifest inspect myrepo/myapp:1.0

Dockerfile cross-compile (Go)

Cross-compile Dockerfile (Go)

# syntax=docker/dockerfile:1.4
FROM --platform=$BUILDPLATFORM golang:1.22 AS builder
ARG TARGETOS TARGETARCH
WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
    go build -o /app

FROM alpine:latest
COPY --from=builder /app /usr/local/bin/
CMD ["app"]
Validation Vous lancez un build multi-arch et inspectez le manifest pour confirmer la présence de plusieurs entrées (linux/amd64, linux/arm64).
Validation You run a multi-arch build and inspect the manifest to confirm multiple entries (linux/amd64, linux/arm64).
11

Sécurité — Distroless, non-root, scan critique

Security — Distroless, non-root, scan critical

Durée 1 h Niveau Intermédiaire Source LAB11-SecurityBestPractices.md
Duration 1 h Level Intermediate Source LAB11-SecurityBestPractices.md

Objectif

Goal

Le lab le plus important du repository. Trois piliers de la sécurité de conteneurs en 2026 : image minimale, utilisateur non-root, scan systématique.

The most important lab in the repository. Three pillars of container security in 2026: minimal image, non-root user, systematic scanning.

ubuntu:22.04 ~ 78 MB shell, apt, etc. ~ 100 CVEs alpine:3.19 ~ 7 MB apk, sh ~ 5-10 CVEs distroless/static ~ 2 MB ~ 0 CVEs
Schéma 8. Comparaison des images de base. Distroless = pas de shell, pas de package manager, surface d'attaque divisée par dix.
Diagram 8. Base image comparison. Distroless = no shell, no package manager, attack surface divided by ten.

Pilier 1 — Image minimale (distroless)

Pillar 1 — Minimal image (distroless)

FROM node:20 AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .

# Final : aucun shell, aucun package manager
FROM gcr.io/distroless/nodejs20-debian12
COPY --from=builder /app /app
WORKDIR /app
CMD ["index.js"]
FROM node:20 AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .

# Final: no shell, no package manager
FROM gcr.io/distroless/nodejs20-debian12
COPY --from=builder /app /app
WORKDIR /app
CMD ["index.js"]

Pilier 2 — Utilisateur non-root

Pillar 2 — Non-root user

D'après le rapport Sysdig 2024, 58% des images en production tournent en root. Si un attaquant s'évade du conteneur, il a alors les droits root sur l'hôte.

According to the Sysdig 2024 report, 58% of production images run as root. If an attacker escapes the container, they get root on the host.

FROM alpine:3.19
RUN addgroup -S app && adduser -S app -G app
COPY --chown=app:app . /app
USER app
WORKDIR /app
CMD ["./run.sh"]

Pilier 3 — Scan de vulnérabilités

Pillar 3 — Vulnerability scanning

# Trivy (open source, le plus populaire)
trivy image myapp:latest

# Docker Scout (intégré à Docker Desktop)
docker scout quickview myapp:latest
docker scout cves myapp:latest
docker scout recommendations myapp:latest

# En CI/CD : échec si CVE critique
trivy image --severity CRITICAL --exit-code 1 myapp:latest
# Trivy (open source, the most popular)
trivy image myapp:latest

# Docker Scout (built into Docker Desktop)
docker scout quickview myapp:latest
docker scout cves myapp:latest
docker scout recommendations myapp:latest

# In CI/CD: fail on critical CVE
trivy image --severity CRITICAL --exit-code 1 myapp:latest
Règle d'or Le scan en local ne sert à rien s'il n'est pas intégré au CI/CD. Configurer GitHub Actions, Azure DevOps Pipeline ou GitLab CI pour faire échouer toute PR qui introduit un CVE critique.
Golden rule Local scanning is worthless if it isn't wired into CI/CD. Configure GitHub Actions, Azure DevOps Pipeline or GitLab CI to fail any PR that introduces a critical CVE.
Validation Vous transformez n'importe quel Dockerfile naïf en version distroless, non-root, scannée et propre. Vous savez expliquer pourquoi USER app doit venir après les RUN qui nécessitent root.
Validation You can turn any naive Dockerfile into a distroless, non-root, scanned, clean version. You can explain why USER app must come after the RUNs that need root.
12

Healthchecks et .dockerignore 2024+

Healthchecks and .dockerignore 2024+

Durée 30 min Niveau Débutant Source LAB12-HealthchecksDockerignore.md
Duration 30 min Level Beginner Source LAB12-HealthchecksDockerignore.md

Objectif

Goal

Deux pratiques de production souvent oubliées en formation : la santé applicative (au-delà du simple "le conteneur tourne") et la maîtrise du contexte de build.

Two production practices often forgotten in training: application health (beyond the simple "the container is running") and control over the build context.

Healthcheck — Au-delà du Up

Healthcheck — Beyond Up

Sans HEALTHCHECK, Docker affiche Up même si l'application est gelée ou ne répond plus. Le healthcheck permet à Docker (et Compose, et orchestrateurs) de détecter une panne applicative.

Without HEALTHCHECK, Docker shows Up even if the application is frozen or unresponsive. The healthcheck lets Docker (and Compose, and orchestrators) detect an application failure.

FROM nginx:alpine

HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD wget --quiet --tries=1 --spider http://localhost/ || exit 1

Paramètres

Parameters

  • --interval : fréquence de vérification (30s par défaut)
  • --timeout : durée max avant timeout (30s par défaut)
  • --start-period : délai de démarrage avant les premières vérifications
  • --retries : nombre d'échecs consécutifs avant marqué unhealthy
  • --interval: check frequency (30s by default)
  • --timeout: max duration before timeout (30s by default)
  • --start-period: warmup delay before the first checks
  • --retries: number of consecutive failures before marking unhealthy

.dockerignore — Maîtriser le contexte de build

.dockerignore — Control the build context

Sans .dockerignore, votre build context envoie tout le contenu du dossier au daemon, y compris :

Without .dockerignore, your build context sends the entire folder to the daemon, including:

  • Le dossier .git (souvent énorme)
  • node_modules/ ou venv/ (vont être réinstallés dans l'image)
  • Fichiers de secrets : .env, id_rsa, credentials.json
  • The .git directory (often huge)
  • node_modules/ or venv/ (which will be reinstalled inside the image)
  • Secret files: .env, id_rsa, credentials.json

.dockerignore minimal recommandé

Recommended minimal .dockerignore

# Git
.git
.gitignore

# Dépendances locales
node_modules
venv
__pycache__
*.pyc

# Build
dist
build
target

# Secrets (CRITIQUE)
.env
.env.*
*.pem
*.key
secrets/

# IDE & OS
.vscode
.idea
.DS_Store

# Documentation et tests (optionnel)
*.md
README*
tests/
# Git
.git
.gitignore

# Local dependencies
node_modules
venv
__pycache__
*.pyc

# Build
dist
build
target

# Secrets (CRITICAL)
.env
.env.*
*.pem
*.key
secrets/

# IDE & OS
.vscode
.idea
.DS_Store

# Documentation and tests (optional)
*.md
README*
tests/
Important pour Kubernetes En Kubernetes, le HEALTHCHECK Dockerfile est ignoré. K8s utilise ses propres mécanismes : livenessProbe, readinessProbe, startupProbe. Bonne nouvelle : les concepts sont identiques.
Important for Kubernetes In Kubernetes, the Dockerfile HEALTHCHECK is ignored. K8s uses its own mechanisms: livenessProbe, readinessProbe, startupProbe. Good news: the concepts are identical.
Validation Vous ajoutez un healthcheck à un service existant et vérifiez qu'il passe à unhealthy quand vous bloquez l'application. Vous comprenez l'impact sécuritaire d'un .dockerignore manquant.
Validation You add a healthcheck to an existing service and verify it transitions to unhealthy when you block the application. You understand the security impact of a missing .dockerignore.
§ 06 — Référence § 06 — Reference

Cheatsheet — Les commandes à connaître

Cheatsheet — The commands to know

Une page-aide-mémoire à imprimer ou à garder ouverte dans un onglet.

A reference page to print or keep open in a tab.

Images

docker image ls                          # lister
docker image build -t name:tag .         # construire
docker image pull name:tag               # télécharger
docker image push name:tag               # publier
docker image rm name:tag                 # supprimer
docker image prune -a                    # nettoyer (toutes images orphelines)
docker image inspect name:tag            # détails JSON
docker image history name:tag            # couches
docker image ls                          # list
docker image build -t name:tag .         # build
docker image pull name:tag               # download
docker image push name:tag               # publish
docker image rm name:tag                 # remove
docker image prune -a                    # clean (all orphan images)
docker image inspect name:tag            # JSON details
docker image history name:tag            # layers

Conteneurs

Containers

docker container ls -a                   # lister tous (running + stopped)
docker container run -d --name n image   # lancer en background
docker container run -it --rm image sh   # interactif jetable
docker container exec -it n sh           # shell dans un conteneur
docker container logs -f n               # suivre les logs
docker container stop n                  # arrêter (SIGTERM)
docker container kill n                  # tuer (SIGKILL)
docker container rm -f n                 # supprimer
docker container stats                   # top-like temps réel
docker container inspect n               # détails JSON
docker container prune                   # supprimer tous arrêtés
docker container ls -a                   # list all (running + stopped)
docker container run -d --name n image   # launch in background
docker container run -it --rm image sh   # interactive throwaway
docker container exec -it n sh           # shell into a container
docker container logs -f n               # follow logs
docker container stop n                  # stop (SIGTERM)
docker container kill n                  # kill (SIGKILL)
docker container rm -f n                 # remove
docker container stats                   # real-time top-like
docker container inspect n               # JSON details
docker container prune                   # remove all stopped

Volumes

docker volume create name
docker volume ls
docker volume inspect name
docker volume rm name
docker volume prune                      # supprimer orphelins
docker volume create name
docker volume ls
docker volume inspect name
docker volume rm name
docker volume prune                      # remove orphans

Réseaux

Networks

docker network create --driver bridge mynet
docker network ls
docker network inspect mynet
docker network connect mynet container
docker network rm mynet

Compose v2

docker compose up -d                     # démarrer en arrière-plan
docker compose ps                        # lister
docker compose logs -f service           # logs d'un service
docker compose exec service sh           # shell dans un service
docker compose restart service           # redémarrer un service
docker compose down                      # tout arrêter
docker compose down -v                   # + supprimer volumes
docker compose pull                      # mettre à jour les images
docker compose build                     # reconstruire
docker compose up -d                     # start in background
docker compose ps                        # list
docker compose logs -f service           # logs of a service
docker compose exec service sh           # shell into a service
docker compose restart service           # restart a service
docker compose down                      # stop everything
docker compose down -v                   # + remove volumes
docker compose pull                      # update images
docker compose build                     # rebuild

Buildx (multi-arch)

docker buildx ls
docker buildx create --name multi --use
docker buildx build --platform linux/amd64,linux/arm64 \
  -t name:tag --push .

Système

System

docker system df                         # utilisation disque
docker system prune -a --volumes         # grand ménage
docker info                              # informations daemon
docker events                            # flux d'événements
docker system df                         # disk usage
docker system prune -a --volumes         # big cleanup
docker info                              # daemon info
docker events                            # event stream
§ 07 — Suite logique § 07 — What's next

Vers Kubernetes — Ce qui se transpose

Toward Kubernetes — What carries over

Une fois Fast-Docker maîtrisé, Kubernetes devient la suite naturelle pour qui vise la production. Bonne nouvelle : la plupart des concepts Docker se retrouvent en K8s, sous d'autres noms.

Once Fast-Docker is mastered, Kubernetes becomes the natural next step for anyone aiming at production. Good news: most Docker concepts reappear in K8s, under different names.

Docker (ce guide)KubernetesNote
Image, registry, pullImage, registry, imagePullSecretsIdentique, K8s ajoute la gestion des credentials
ConteneurPod (1+ conteneurs)Le pod est l'unité de déploiement K8s
Compose serviceDeployment + ServiceDéploiement répliqué + exposition réseau
depends_on healthyinitContainers + probesConteneurs d'init avant le pod principal
Volume DockerPersistentVolumeClaimDemande de stockage abstraite
Bridge / overlay networkCNI (Calico, Cilium, Flannel)Plugins réseau enfichables
HEALTHCHECKlivenessProbe / readinessProbeLe HEALTHCHECK Dockerfile est ignoré en K8s
USER non-rootsecurityContext.runAsNonRoot: trueIdentique, contrôle plus granulaire en K8s
Multi-stage buildIdentiquePréparer images CKA légères
Variables d'envConfigMap + SecretK8s sépare configuration et secrets
Docker (this guide)KubernetesNote
Image, registry, pullImage, registry, imagePullSecretsSame, K8s adds credentials management
ContainerPod (1+ containers)The pod is the K8s deployment unit
Compose serviceDeployment + ServiceReplicated deployment + network exposure
depends_on healthyinitContainers + probesInit containers before the main pod
Docker volumePersistentVolumeClaimAbstract storage request
Bridge / overlay networkCNI (Calico, Cilium, Flannel)Pluggable network plugins
HEALTHCHECKlivenessProbe / readinessProbeDockerfile HEALTHCHECK is ignored in K8s
USER non-rootsecurityContext.runAsNonRoot: trueSame, more granular control in K8s
Multi-stage buildSamePrepare lightweight CKA images
Env variablesConfigMap + SecretK8s separates configuration and secrets

Concepts Docker non couverts par CKA mais essentiels

Docker concepts not covered by CKA but essential

Le syllabus CKA est centré ops, pas build. Les compétences suivantes restent à votre charge :

The CKA syllabus is ops-focused, not build-focused. The following skills remain on you:

  • Multi-stage builds
  • BuildKit et build secrets
  • Distroless
  • Scan de vulnérabilités
  • Multi-arch builds
  • Multi-stage builds
  • BuildKit and build secrets
  • Distroless
  • Vulnerability scanning
  • Multi-arch builds

Ce guide les couvre toutes — ne les zappez pas même si elles ne sont pas testées au CKA.

This guide covers all of them — don't skip them even if they aren't tested in CKA.

§ 08 — Pour aller plus loin § 08 — Going further

Ressources externes

External resources

Documentation officielle

Official documentation

Outils complémentaires

Complementary tools

  • dive — explorer les couches d'une image visuellement
  • hadolint — linter Dockerfile (à mettre en pre-commit Git)
  • Trivy — scanner de vulnérabilités open source
  • Distroless — images minimales Google
  • Chainguard Images — alternative distroless durcie
  • dive — visually explore an image's layers
  • hadolint — Dockerfile linter (use as a Git pre-commit)
  • Trivy — open-source vulnerability scanner
  • Distroless — Google minimal images
  • Chainguard Images — hardened distroless alternative

Sécurité

Security

Pratique en ligne

Online practice


Lire la documentation, c'est apprendre la grammaire. Faire les labs, c'est apprendre à parler.

Reading the docs is learning the grammar. Doing the labs is learning to speak.

Comment utiliser ce fork au quotidien

How to use this fork day-to-day

  1. Forker le repository pour avoir votre copie.
  2. Cloner en local : git clone.
  3. Créer un dossier notes/ où vous prenez vos notes lab par lab.
  4. Tenir un journal des erreurs rencontrées et de leurs résolutions — c'est le contenu le plus précieux à long terme.
  5. Synchroniser périodiquement avec l'upstream omerbsezer/Fast-Docker pour récupérer les mises à jour.
  1. Fork the repository to get your own copy.
  2. Clone locally: git clone.
  3. Create a notes/ folder where you keep notes lab by lab.
  4. Keep a journal of errors encountered and how you fixed them — that's the most valuable long-term content.
  5. Sync periodically with the upstream omerbsezer/Fast-Docker to pick up updates.