Skip to the page

Cloud and operations · 8 concepts

Docker

Containers explained, and a Dockerfile and compose file for a web service that you can write and defend.

Part 1 · 3 concepts

Containers, Dockerfiles and layers

  1. 01

    Containers vs VMs, images vs containers

    A container is a normal process isolated with Linux namespaces and limited with cgroups, sharing the host's kernel and started from an image (a read-only stack of…

  2. 02

    Writing a Dockerfile

    A Dockerfile is a list of build instructions: FROM picks a base image, WORKDIR, COPY and RUN prepare the filesystem, ENV and USER set the runtime environment, and CMD…

  3. 03

    Layers and the build cache

    Each filesystem-changing instruction creates a layer, and Docker reuses a cached layer until that instruction or the files it copies change, after which every later…

Part 2 · 5 concepts

Docker for Node and Next.js apps

  1. 04

    Multi-stage builds for Node and Next.js

    A multi-stage Dockerfile builds the app in one stage with all dev dependencies and tools, then copies only the built output and production dependencies into a small…

  2. 05

    Running Node correctly in a container

    In a container, start node directly in exec form (or behind a tiny init such as tini via docker run --init), run as the non-root node user with NODE_ENV=production, log…

  3. 06

    Image security: small bases, non-root, no secrets

    Secure images start from a small, trusted, regularly patched base, run as a non-root user, never contain secrets in any layer, and are scanned and rebuilt often so…

  4. 07

    docker compose for local stacks

    docker compose runs several containers (API, Postgres, Redis) from one compose.yaml with a shared network where services reach each other by service name, named volumes…

  5. 08

    Docker in CI and deploys

    In CI you build the image once with BuildKit, tag it with the git commit (plus a version), scan it, push it to a registry and deploy that exact image (ideally by…

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview