Tous les cours
Débutant 12 hours Gratuit

Docker Basics: Containers from scratch

Learn Docker by practicing in a terminal inside your browser: containers, images, Dockerfiles, layer caching, volumes, networks, Docker Compose and how to publish your images to a registry.

Badge du cours Docker Basics Termine toutes les leçons pour le gagner.
Docker Basics: Containers from scratch

Contenu du cours

Module 1

First steps

3 leçons
1

What is a container?

The "works on my machine" problem, what a container is, how it differs from a virtual machine, what images are and what Docker is used for.

20 min Gratuit
2

Installing Docker

How to install Docker Desktop on Windows and macOS or Docker Engine on Linux, check the installation with docker version and docker info, and run your first test container.

25 min Gratuit
3

Your first container

How docker run works: downloading an image, running a command inside a container, getting in with an interactive terminal (-it), naming it and deleting it when it finishes with --rm.

30 min Gratuit
Module 2

Working with containers

4 leçons
4

The container lifecycle

The states of a container (created, running, stopped), how to list them with docker ps, run them in the background with -d, stop them, start them again and remove them.

30 min Gratuit
5

Servers, ports and logs

Run a web server in a container, publish its ports with -p to reach it from your computer, and read what happens inside with docker logs.

30 min Gratuit
6

Getting into and inspecting containers

Run commands inside a container that's already running with docker exec, see its configuration with docker inspect, its processes with docker top, its resource usage with docker stats, and copy files with docker cp.

30 min Gratuit
7

Configuring with environment variables

Pass configuration to a container with -e and --env-file, see the variables from inside, configure a PostgreSQL database and why secrets don't belong in the image.

25 min Gratuit
Module 3

Images

5 leçons
8

Images and Docker Hub

How images are named (registry, user, repository and tag), downloading them with docker pull, listing them, choosing variants like alpine or slim, tagging them with docker tag and removing them with docker rmi.

30 min Gratuit
9

Your first Dockerfile

Create your own images with a Dockerfile: FROM, WORKDIR, COPY, RUN and CMD, the build context, docker build -t, and how to package a website and a Node app.

35 min Gratuit
10

Layers and the build cache

How an image is built inside: read-only layers, each container's writable layer, docker history, why the cache speeds up builds and how to order the Dockerfile to take advantage of it.

30 min Gratuit
11

Dockerfile in depth

More Dockerfile instructions: ENV and ARG for variables, EXPOSE to document ports, LABEL for metadata, the difference between ENTRYPOINT and CMD, and .dockerignore to keep out what shouldn't go in.

35 min Gratuit
12

Small and secure images

Reduce the size of your images by choosing the right base, installing only what's needed and using multi-stage builds, and make them more secure by running the app as an unprivileged user.

35 min Gratuit
Module 4

Data

2 leçons
13

Volumes: data that survives

Why a container's data is lost when you remove it, how to create and use volumes with docker volume and -v, share data between containers, anonymous volumes and read-only mounts.

35 min Gratuit
14

Bind mounts for development

Mount a folder from your computer inside a container to see changes instantly, develop a Node app with automatic reload, the node_modules trick and when to use a bind mount or a volume.

30 min Gratuit
Module 5

Networks

2 leçons
15

Docker networks

How containers communicate: the default bridge network, creating your own networks with docker network, the DNS that resolves containers by name, connecting and disconnecting containers, and the host and none networks.

35 min Gratuit
16

An app with its database

Connect two containers for real: a Node API that stores a counter in Redis, with its network, its volume and configuration through environment variables, and how to diagnose when they can't find each other.

35 min Gratuit
Module 6

Docker Compose

3 leçons
17

Your first compose.yaml

Describe a multi-container application in a compose.yaml file and manage it with docker compose up, ps, logs and down: services, images, build, ports, variables and the network Compose creates for you.

35 min Gratuit
18

Compose in depth

Wait until the database is ready with healthcheck and depends_on, move configuration to a .env file, separate services into networks, restart policies, and the exec, run and config commands.

40 min Gratuit
19

Compose for development

Use Docker Compose as a development environment: code mounted with bind mounts, automatic reload, overriding the image's command, rebuilding with --build when dependencies change, and an introduction to compose watch and profiles.

30 min Gratuit
Module 7

Publishing and production

3 leçons
20

Publishing images to a registry

Share your images: log in with docker login, name them with your user, push them with docker push to Docker Hub or GitHub Container Registry, version them with tags and download them on another computer.

30 min Gratuit
21

Cleanup and best practices

See how much space Docker uses and free it with prune without deleting what matters, keep containers alive with restart policies and healthchecks, limit their memory and CPU, and a checklist of best practices for production.

35 min Gratuit
22

Final project: a complete shop

Dockerize a three-piece application from start to finish (nginx frontend, Node API and PostgreSQL): Dockerfiles, multi-stage build, reverse proxy, separate networks, healthchecks, volumes, Compose and publishing to a registry.

50 min Gratuit

Construisez votre présence numérique

Commencez aujourd’hui : écrivez-nous, nous répondons en moins de 24 heures.