Docker Tutorials
Docker from the ground up — images, Dockerfiles, layer caching, multi-stage builds, networking, volumes, Compose and shipping to production, every example lifted from a real ordering app.
- Docker – Interview QuestionsThe questions Docker interviews actually ask, answered the way you would say them out loud. Container versus VM, image versus container, `CMD` versus `ENTRYPOINT`, `COPY` versus `ADD`, how layer caching works, where volumes fit, and the "why is my image 1.2 GB" question that separates people who have shipped one.
- Docker – Running Containers in ProductionWhat changes when it is not your laptop. Restart policies, memory and CPU limits and what the JVM does when you forget them, log drivers and why logs go to stdout, graceful shutdown and `SIGTERM`, read-only filesystems, and an honest account of where plain Docker stops and an orchestrator starts.
- Docker – Building and Pushing from GitHub ActionsA workflow that builds the image, tags it from the git ref, pushes it to a registry and does not leak a credential. `docker/build-push-action`, why a CI runner starts with an empty layer cache and what `cache-from`/`cache-to` do about it, and using GitHub's OIDC token instead of storing a long-lived key.
- Docker – Multi-Platform Builds and exec format errorYou build on an Apple Silicon Mac, you push, the server says `exec format error`. Why that happens, what buildx and QEMU do about it, `--platform` for one target and a manifest list for both, what emulated builds cost in time, and the `--platform=$BUILDPLATFORM` trick that makes a cross build fast again.
- Docker – Registries, Tagging and Pushing an ImageHow an image gets from your laptop to a server. What a registry reference is really made of, `login` and `push`, Docker Hub versus ECR versus GHCR, a tagging scheme that survives a rollback, and why deploying `:latest` means you cannot answer the question "what is actually running?"
- Docker Compose – The Whole Application in One FilePutting it together: MySQL, a Spring Boot API and an nginx-served single-page app, started with one command and torn down with another. The SPA rewrite rule every static host needs, reverse-proxying `/api` so the browser sees one origin and CORS stops mattering, and what this file is still not good enough for.
- Docker Compose – Profiles, Overrides and Multiple FilesNot every service should start every time. Compose profiles put Elasticsearch, a message broker and a mail sink behind opt-in flags so the default `up` starts one container. Then `compose.override.yaml`, stacking `-f` files for dev and prod, and how `${VAR}` and `.env` interpolation works.
- Docker Compose – depends_on, Healthchecks and Startup Order`depends_on` waits for the container to start, not for the service inside it to be ready — so the app races MySQL and dies on a connection refused that looks like a database bug. Writing a healthcheck, `condition: service_healthy`, `up --wait`, and why the app should still retry anyway.
- Docker Compose – Running a Multi-Container StackOnce an app needs a database, `docker run` becomes a shell script nobody can read. The compose file, `up` and `down`, what a service is, the network and project name you get for free, `--build` versus `--force-recreate`, and why `docker-compose` with a hyphen is the old one.
- Docker – Logs, Exec and Debugging a ContainerYour container exited, or it says `unhealthy`, or it will not connect to the database. `logs -f`, `exec -it sh` into a running container, `inspect` for the config it actually got, `stats` for resources, what the exit code means, and the healthcheck that reported unhealthy forever because the image had no `curl` in it.
- Docker – Environment Variables, Build Args and SecretsOne image, many environments — the whole point of configuring from outside. `ENV` versus `ARG` and why a build arg is baked into the image forever, `--env-file`, Spring Boot's relaxed binding turning `SPRING_DATASOURCE_URL` into a property, frontend config that is baked at build time, and where secrets actually go.
- Docker – Volumes, Bind Mounts and Keeping Your DataA container's filesystem dies with it, so a database in a container needs somewhere else to write. Named volumes versus bind mounts, which to use for a database and which for live-reloading source, what `docker compose down -v` throws away, and why a bind-mounted database is measurably slower on a Mac.
- Docker – Ports, Networks and Container DNS`-p 3308:3306` has a host side and a container side and mixing them up is the single most common Docker mistake. Bridge networks, how containers resolve each other by service name, why `localhost` inside a container is not your laptop, and the `host.docker.internal` escape hatch.
- Docker – Don't Run as RootA container runs as root unless you say otherwise, and root in the container is root on the kernel it shares with you. Creating and switching to a non-root user, why port 80 then stops working, keeping secrets out of image layers, scanning with `docker scout`, and pinning a base image by digest.
- Docker – Choosing a Base Image and Keeping It Small`-slim`, `-alpine` and distroless, what each actually removes, and the musl-versus-glibc surprise that makes Alpine the wrong default for some runtimes. Measured sizes from the pizza images, what genuinely shrinks a build versus what only looks like it does, and why a smaller image matters most at pull time.
- Docker – Multi-Stage BuildsBuild in one image, ship from another. The pizza API compiles with Maven and a full JDK, then copies one jar into a JRE image — no Maven, no source, no build cache in the result. The frontends do the same with Node and nginx. Named stages, `COPY --from`, and stopping at a stage with `--target`.
- Docker – Layer Caching and Build SpeedOne rule explains most fast Dockerfiles: copy the dependency manifest and install dependencies *before* copying your source. How the cache is keyed, why one changed line can invalidate every layer after it, the `pom.xml`-first and `package.json`-first patterns, and BuildKit cache mounts.
- Docker – The Build Context and .dockerignore`docker build .` uploads that entire directory to the builder before it reads a single instruction — which is why a build can sit for a minute doing apparently nothing. What the context is, why `node_modules` and `target/` must never be in it, and the `.dockerignore` files that took one build from 900 MB of context to 2 MB.
- Docker – Writing a DockerfileThe instructions that actually matter: `FROM`, `WORKDIR`, `COPY`, `RUN`, `ENV`, `EXPOSE`, `USER`, and the `CMD` versus `ENTRYPOINT` distinction that trips up everyone once. Built up line by line into the real Dockerfile that produces the pizza API image.
- Docker – Images, Layers and TagsAn image is a stack of read-only layers and a container is a thin writable layer on top — which explains sharing, caching, image size and why editing a file in a running container changes nothing permanent. Reading `docker history`, what a tag really is, and why a digest is the only thing that pins an image.
- Docker – Install It and Run Your First ContainerDocker Desktop or Docker Engine, and how to tell which one you have. Then the six commands you will use every day — `run`, `ps`, `logs`, `exec`, `stop`, `rm` — what each flag in `docker run -d -p 8080:80 nginx` is doing, and why your container exited the instant it started.
- Docker – What It Is and Why It ExistsStart here. What a container actually is and how it differs from a virtual machine, the "works on my machine" problem it was built to solve, the difference between an image and a container, the exact versions this track is written against, the demo application every example is taken from, and the full lesson index in reading order.