Manuel Pratique · Édition 2026Practical 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.
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).
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.xdocker compose version # v2.x (avec espace, pas de tiret)docker buildx version # buildx présent par défautdocker run hello-world # test fonctionnel
docker version # client + daemon >= 24.xdocker compose version # v2.x (with space, no dash)docker buildx version # buildx ships by defaultdocker 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.
Outil
Rôle
Installation
dive
Inspecter les couches d'une image
brew install dive
trivy
Scanner les vulnérabilités
brew install trivy
hadolint
Linter les Dockerfile
brew install hadolint
ctop
top-like pour conteneurs
brew install ctop
lazydocker
Interface terminal pour Docker
brew install lazydocker
Tool
Role
Install
dive
Inspect an image's layers
brew install dive
trivy
Vulnerability scanner
brew install trivy
hadolint
Dockerfile linter
brew install hadolint
ctop
top-like for containers
brew install ctop
lazydocker
Terminal UI for Docker
brew 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.
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).
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.
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.
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.
Ordre
Lab
Pourquoi à ce moment
Durée
1
LAB 01 — Premier conteneur
Poser les bases : build, run, exec, logs, rm
45 min
2
LAB 06 — Transferts
Débugger, copier des fichiers entre conteneur et hôte
20 min
3
LAB 02 — Volumes
Persister la donnée (sinon tout est perdu)
45 min
4
LAB 12 — Healthchecks
Pratique production souvent oubliée
30 min
5
LAB 03 — Compose
Orchestrer plusieurs services
1 h
6
LAB 09 — Configuration
Maîtriser le daemon, proxy, registry mirrors
30 min
7
LAB 05 — Registry
Publier ses propres images
45 min
8
LAB 07 — Build Linux
Multi-stage build (concept clé)
45 min
9
LAB 11 — Sécurité
Distroless, non-root, scan
1 h
10
LAB 10 — Multi-arch
Compatibilité ARM/AMD64
45 min
11
LAB 04 — Swarm legacy
Lecture culturelle, passerelle vers K8s
30 min
12
LAB 08 — Build Windows
Optionnel, niche Windows uniquement
30 min
Order
Lab
Why at this point
Duration
1
LAB 01 — First container
Lay the basics: build, run, exec, logs, rm
45 min
2
LAB 06 — Transfers
Debug, copy files between container and host
20 min
3
LAB 02 — Volumes
Persist data (otherwise everything is lost)
45 min
4
LAB 12 — Healthchecks
Production practice often forgotten
30 min
5
LAB 03 — Compose
Orchestrate multiple services
1 h
6
LAB 09 — Configuration
Master the daemon, proxy, registry mirrors
30 min
7
LAB 05 — Registry
Publish your own images
45 min
8
LAB 07 — Linux build
Multi-stage build (key concept)
45 min
9
LAB 11 — Security
Distroless, non-root, scan
1 h
10
LAB 10 — Multi-arch
ARM/AMD64 compatibility
45 min
11
LAB 04 — Swarm legacy
Cultural read, gateway to K8s
30 min
12
LAB 08 — Windows build
Optional, Windows niche only
30 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.
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.
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 exactementDockerfile, 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 exactlyDockerfile, 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.
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.
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
Type
Cas d'usage
Exemple
Volume nommé
Production, données applicatives
Base de données MySQL
Bind mount
Développement, hot reload
Code source d'une app web en dev
tmpfs
Secrets éphémères, cache
Tokens d'auth temporaires
Type
Use case
Example
Named volume
Production, application data
MySQL database
Bind mount
Development, hot reload
Source code of a web app in dev
tmpfs
Ephemeral secrets, cache
Temporary 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).
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
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.
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édiaireSource LAB04-DockerStackService.md
Duration 30 min (reading)Level IntermediateSource 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:
Swarm
Kubernetes
Concept
service create
Deployment + Service
Workload répliqué
service scale
kubectl scale deployment
Mise à l'échelle
service update --image
kubectl set image
Rolling update
service rollback
kubectl rollout undo
Retour arrière
stack
Helm chart
Multi-services packagés
overlay network
CNI plugin
Réseau multi-host
Swarm
Kubernetes
Concept
service create
Deployment + Service
Replicated workload
service scale
kubectl scale deployment
Scaling
service update --image
kubectl set image
Rolling update
service rollback
kubectl rollout undo
Rollback
stack
Helm chart
Multi-service packaging
overlay network
CNI plugin
Multi-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
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.
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.
Astucedocker cp fonctionne même sur un conteneur arrêté. Très utile pour récupérer un état post-mortem après un crash.
Tipdocker cp works even on a stopped container. Very useful for retrieving post-mortem state after a crash.
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.
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 : buildFROM golang:1.22 AS builder
WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 go build -o /app
# Stage 2 : runtime minimalisteFROM gcr.io/distroless/static-debian12
COPY --from=builder /app /app
USER 65532
ENTRYPOINT ["/app"]
# Stage 1: buildFROM golang:1.22 AS builder
WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 go build -o /app
# Stage 2: minimal runtimeFROM 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.
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).
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.
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.
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.4FROM --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).
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.
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 managerFROM 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 managerFROM 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.
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.
# 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.
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
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)
Kubernetes
Note
Image, registry, pull
Image, registry, imagePullSecrets
Identique, K8s ajoute la gestion des credentials
Conteneur
Pod (1+ conteneurs)
Le pod est l'unité de déploiement K8s
Compose service
Deployment + Service
Déploiement répliqué + exposition réseau
depends_on healthy
initContainers + probes
Conteneurs d'init avant le pod principal
Volume Docker
PersistentVolumeClaim
Demande de stockage abstraite
Bridge / overlay network
CNI (Calico, Cilium, Flannel)
Plugins réseau enfichables
HEALTHCHECK
livenessProbe / readinessProbe
Le HEALTHCHECK Dockerfile est ignoré en K8s
USER non-root
securityContext.runAsNonRoot: true
Identique, contrôle plus granulaire en K8s
Multi-stage build
Identique
Préparer images CKA légères
Variables d'env
ConfigMap + Secret
K8s sépare configuration et secrets
Docker (this guide)
Kubernetes
Note
Image, registry, pull
Image, registry, imagePullSecrets
Same, K8s adds credentials management
Container
Pod (1+ containers)
The pod is the K8s deployment unit
Compose service
Deployment + Service
Replicated deployment + network exposure
depends_on healthy
initContainers + probes
Init containers before the main pod
Docker volume
PersistentVolumeClaim
Abstract storage request
Bridge / overlay network
CNI (Calico, Cilium, Flannel)
Pluggable network plugins
HEALTHCHECK
livenessProbe / readinessProbe
Dockerfile HEALTHCHECK is ignored in K8s
USER non-root
securityContext.runAsNonRoot: true
Same, more granular control in K8s
Multi-stage build
Same
Prepare lightweight CKA images
Env variables
ConfigMap + Secret
K8s 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.