Docker & Docker Compose — The course

Guide 01 / 3

Docker glossary

Understand how images, containers, networks, volumes and services work.

Expected outcome :

Identify the Docker concepts and explain their role in your own words.

Reading
0%

01 · Understanding containers

Docker lets you run an application with what it needs, reproducibly. The host machine and the containers share the system kernel: a container is therefore not a complete virtual machine.

Container

An isolated environment in which one or more processes linked to an application run. It uses the host's kernel, but has its own view of files, processes and networks.

Une instance Nginx qui sert un site web.
Remember :

A container can be stopped and replaced: do not keep your important data only in its writable layer.

Image

A read-only template of files and metadata used to create containers. It notably contains the application and its dependencies.

L’image nginx:alpine permet de lancer plusieurs conteneurs Nginx.
Remember :

Image = template; container = running of the template.

Docker Engine

The set of components that run and manage containers. It notably includes the Docker daemon and a programming interface.

Le service Docker Engine fonctionne sur un serveur Linux.

Docker daemon (dockerd)

The server process that receives requests from the Docker client then manages images, containers, networks and volumes.

docker ps interroge le démon pour obtenir les conteneurs.

Docker CLI

The command-line interface used from a terminal to communicate with Docker Engine.

docker run, docker build et docker logs sont des commandes CLI.

Host

The physical or virtual computer on which Docker is installed and runs the containers.

Un VPS Ubuntu peut être l’hôte de plusieurs services conteneurisés.

Virtualisation / virtual machine

A VM emulates or virtualises a complete system with its own kernel. A container shares the host's kernel and mainly isolates processes; the uses and levels of isolation differ.

Une VM Linux peut elle-même héberger des conteneurs Docker.

Isolation

Logical separation of processes, file systems and networks, notably with Linux namespaces and cgroups.

Un service dans un conteneur ne voit pas automatiquement les processus des autres.

Main process (PID 1)

The program started first in the container. It generally represents the service to run: web server, Python script or database engine. Its end normally causes the container to stop.

node server.js peut devenir le PID 1 du conteneur.
Remember :

A main process must handle stop signals correctly.

02 · Images and building

An image is built once and can be used to start several containers on different compatible machines.

Dockerfile

A text file that describes the steps for building an image: base image, copying files, installation and default command.

FROM python:3.13-slim

Build

The operation of producing an image from a Dockerfile and a build context.

docker build -t demo:1.0 .

Build context

The set of files made available to the builder for the build, generally a folder. The final dot in docker build . means “current folder”.

COPY . /app prend les fichiers de ce contexte, sauf exclusions.
Remember :

The context does not refer to the directory inside the container.

Layer

A reusable layer of content produced while building an image. Layers make sharing and caching easier.

Une couche peut contenir des bibliothèques installées lors d’un RUN.

Build cache

The result of previous steps kept so as not to redo identical operations. Changes in the copied files can invalidate the following steps.

Copier les dépendances avant le code évite de tout réinstaller à chaque modification.

Tag

A label that identifies a variant or version of an image in an image reference. It is not a guarantee of immutability.

nginx:1.28

Digest

A cryptographic identifier of an image's content, useful for deploying a specific version.

nginx@sha256:…

Registry

A service that stores and distributes container images.

Docker Hub ou un registre privé GitLab.

Docker Hub

The public registry offered by Docker for discovering and distributing images.

docker pull nginx:alpine

.dockerignore

A file defining which paths must not be sent into the build context. It reduces the context size and avoids including certain sensitive items.

node_modules
.git
.env

03 · Running and exchanges

A container is more than a file: it launches a program, can expose ports and exchange data with other services.

RUN

A Dockerfile instruction executed during the build. It changes the content of the image produced and does not start the service at launch.

RUN npm ci

CMD

A Dockerfile instruction that indicates the default command or arguments when the container starts. It can be replaced at docker run.

CMD ["node", "server.js"]

ENTRYPOINT

A Dockerfile instruction that defines the executable to launch at startup. “Main executable” means the program that carries the container's work: nginx, python, node, etc.

ENTRYPOINT ["python", "main.py"]
Remember :

CMD can supply its default arguments.

Container port

The TCP or UDP number on which an application listens inside its network.

Nginx écoute généralement sur le port TCP 80.

EXPOSE

An instruction that documents the port on which the application is meant to listen. On its own it does not open access from the host.

EXPOSE 3000
Remember :

To publish the port, use -p with docker run or ports in Compose.

Port publishing

An association between a port on the host machine and a port in the container.

-p 8080:80 signifie hôte:8080 → conteneur:80.

Environment variable

A named value passed to the process at startup to adapt its behaviour without changing its code.

NODE_ENV=production
Remember :

Do not confuse a variable with a secrets vault.

Healthcheck

A test command run periodically to know whether a service responds according to a defined criterion.

Un test HTTP sur /health peut signaler un service unhealthy.

Restart policy

A rule that tells Docker under what conditions to restart a stopped container.

restart: unless-stopped

04 · Networks, data and Compose

Containers are replaceable; their network and their data require explicit choices.

Named volume

A storage space managed by Docker, separate from a container's lifecycle. It lets you keep a database's files after the container is recreated.

postgres_data:/var/lib/postgresql/data

Bind mount

Mounting a host file or folder inside the container. Handy in development to see changes without rebuilding the image.

./src:/app/src

Persistence

Keeping data beyond the stopping or replacement of a container.

Une base PostgreSQL conserve les tables grâce à un volume.

Network

A Docker virtual network that lets the attached containers communicate.

Le service web appelle la base via son nom db.

Bridge

A common type of Docker network on a single host. The containers on the network can communicate according to the rules in place.

Compose crée généralement un réseau de projet.

Internal DNS

A name resolution service that lets containers on the same network find the others by their service name.

http://api:3000 depuis un conteneur du même projet.

Docker Compose

A tool that describes and drives an application made up of several services using a YAML file.

docker compose up -d

Compose service

The definition of a type of container in compose.yaml: image, ports, volumes and environment.

web et db sont deux services distincts.

Compose project

A logical group of services, networks and volumes managed together and identified by a project name.

name: boutique-demo

YAML

A text data format organised notably by indentation. A Compose file uses YAML to describe a configuration.

services:
  web:
    image: nginx:alpine
Remember :

Indentation is significant: use spaces, not tabs.

Secret

Sensitive information such as a password or a token. Compose supports secrets mounted as files.

Éviter d’inscrire un vrai mot de passe dans le JSON pédagogique ou compose.yaml.