Skip to main content
DevOps

Docker Tutorial with Examples.

Docker tutorial for beginners: containerise applications, build optimised images, configure networking and orchestrate with Docker Compose.

Architecture at a glance

Click any box to open the lesson that teaches it

Docker architecture at a glance

Dockerfile → build → image → registry → docker run → container

Docker architecture at a glance A Dockerfile is built into an image through cached layers, a multi-stage build slims it down, and it is pushed to a registry before docker run starts a container whose main process runs as PID 1. A running container uses volumes, a bridge network and environment variables; Compose brings up multiple services together. A bottom strip covers non-root hardening, a CIS benchmark scan, cosign signing, production controls, and deploying real apps with FastAPI and Spring Boot. Dockerfile Build layers · cache Image multi-stage Registry tag · push docker run Container PID 1 · signals What a container uses Volumes bind mounts Networking bridge · DNS Env & config env vars · inspect Multi-service Compose services · health Secure and ship Non-root CIS bench Cosign Production Shell jobs FastAPI → K8s Spring Boot
How it fits together (7 steps)
  1. Write a Dockerfile and build it. Docker reuses a cached layer only while the instruction and everything before it are unchanged, so slow steps that don't depend on your source (dependency installs) go before the COPY of your code.
  2. A multi-stage build compiles in a full toolchain stage, then copies only the finished artifact into a small runtime stage — a Go binary goes from 287MB to 2.3MB this way.
  3. Push the image to a registry and sign its digest with cosign so a puller verifies the digest, not a movable tag.
  4. docker run starts a container that is just a host process: its main command runs as PID 1, so docker stop sends SIGTERM and only falls back to SIGKILL after the grace period.
  5. A running container uses volumes or bind mounts for data that outlives it, a user-defined bridge network for DNS and published ports, and environment variables for config.
  6. Multiple services are defined once in docker-compose.yml and brought up together, with health checks gating dependent services.
  7. Secure and ship it: run as non-root and drop capabilities, pass a CIS Docker Benchmark scan, manage background jobs and signals from the shell, add health checks, limits and a restart policy for production, and deploy real apps with FastAPI on Kubernetes or a Dockerized Spring Boot jar.

Beginner

Start here — no prior experience needed

3 lessons

Intermediate

For developers with core concepts down

3 lessons

Advanced

Production-grade patterns for experienced engineers

3 lessons

Also part of Docker

Taught in other topics. Each link opens the lesson in its home topic.

5 lessons