Docker Roadmap for Beginners (2026)

A free Docker roadmap for beginners: containers vs VMs, images, Dockerfiles, volumes, networking, Compose, security and debugging, with a project per step.

Level: Beginner · Time: 2–3 months at ~8 h/week · Updated October 2026 by Ali Bashir

Who this roadmap is for

Developers, students and IT folks who keep hearing "just Dockerise it" and want to actually understand containers. You only need basic terminal skills; Linux experience helps but is not required.

By the end you can

  • Explain containers, images and registries in plain words
  • Write small, cache-friendly multi-stage Dockerfiles
  • Run multi-container apps with Docker Compose
  • Build images that run as non-root and pass a vulnerability scan
  • Debug crashing containers and push images from CI
  1. Step 1: Why containers and getting set up

    Containers package an app with everything it needs so it runs the same on your laptop, a teammate's laptop and a server. Understanding what a container really is (and how it differs from a virtual machine) makes every later Docker error easier to read.

    Time: 1 week. Skip if you can explain how a container differs from a virtual machine and you already have Docker running on your machine.

    Topics

    What is a container?
    A container is a running app packed together with its code, libraries and settings, kept separate from other apps on the same machine. It fixes the classic "it works on my machine" problem, because the same package runs the same way everywhere. Docker docs: What is a container? Course: Docker Tutorial for Beginners [FULL COURSE in 3 Hours] (What is a Container?) Video: Containerization Explained
    Containers vs VMs
    A virtual machine (VM) runs a full operating system on virtual hardware, while containers share the host's Linux kernel and only carry the app and its files. That makes containers start in seconds and use far less memory, but VMs give stronger isolation. Docker: What is a container? (vs VMs) Course: Docker Tutorial for Beginners [FULL COURSE in 3 Hours] (Docker vs Virtual Machine) Video: Containers vs VMs: What's the difference?
    Docker architecture
    Docker has three parts: the docker CLI you type into, the Docker daemon (dockerd) that does the real work, and registries that store images. Knowing this explains errors like "Cannot connect to the Docker daemon": the CLI is fine, the background service is not running. Docker docs: Docker overview Course: Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers (Engine) Video: Docker Architecture | Components
    Docker Desktop
    Docker Desktop is the easiest way to run Docker on Windows and macOS: one installer gives you the engine, the CLI, Compose and a simple dashboard. On Windows it runs on WSL 2 (Windows Subsystem for Linux). It is free for personal use, learning and small companies. Docker docs: Docker Desktop Install Docker Desktop on Windows Course: Docker Crash Course for Absolute Beginners [NEW] (Install Docker) Video: Docker Crash Course #2 - Installing Docker
    Podman (alternative)
    Podman is a free, open-source container tool from Red Hat with almost the same commands as Docker (you can even alias docker=podman). It runs without a background daemon and without root by default. An alternative to Docker Desktop; pick one. Podman documentation Podman Desktop Video: What is Podman? How is it Different Than Docker?
    Rancher Desktop (alternative)
    Rancher Desktop is a free, open-source desktop app from SUSE that gives you a container engine and a small local Kubernetes cluster. You can choose the Docker-compatible engine (moby) so normal docker commands work. An alternative to Docker Desktop; pick one. Rancher Desktop docs Video: What is Rancher Desktop?
    Docker Engine on Linux (optional)
    On a Linux machine or server you install Docker Engine directly, without Docker Desktop. Use the official apt or dnf repository (not the old distro package), then add your user to the docker group so you don't need sudo for every command. Install Docker Engine on Ubuntu Linux post-installation steps Course: Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers (Install Docker) Video: Docker Engine for Linux Servers Setup and Tips
    Colima (optional)
    Colima is a small, free command-line tool that runs a Linux VM with a container engine on macOS (and Linux). Many Mac users use it with the normal docker CLI when they don't want Docker Desktop. Good to know, not required. Colima on GitHub Video: Colima | Open Source alternative for Docker Desktop | Productivity
    Namespaces & cgroups (optional)
    Containers are built from two Linux kernel features: namespaces hide other processes, networks and files from the container, and cgroups (control groups) limit how much CPU and memory it can use. You don't need them to use Docker, but they explain what "isolation" really means. namespaces(7) manual page cgroups(7) manual page Course: Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers (Engine) Video: How Docker Works - Intro to Namespaces
    OCI standards (optional)
    The OCI (Open Container Initiative) writes the open standards for container images and runtimes. Because of OCI, an image built with Docker also runs on Podman, Kubernetes and cloud services. Good to know so the words "OCI image" don't confuse you. OCI: About the Open Container Initiative Video: What is the Open Container Initiative?

    Project: Hello, containers

    Install Docker Desktop (or Podman), run the hello-world and nginx images, and open nginx in your browser. Write a short README in your own words explaining containers vs VMs, with a screenshot of docker ps.

    Common mistakes

    • Treating a container like a small virtual machine. Run one main process per container and keep it disposable. Anything you need to keep goes in a volume or a database, not inside the container.
    • Running docker commands without access to the Docker daemon. The CLI only talks to the daemon (dockerd), so check it is running with docker info. On Linux, add your user to the docker group or use rootless mode instead of prefixing everything with sudo.
    • Assuming a container is as isolated as a separate machine. Containers share the host's Linux kernel and are separated by namespaces and cgroups. Keep the host patched and avoid flags like --privileged that remove that separation.

    You're ready to move on when you can

    • Explain the difference between a container and a VM in two sentences
    • Run docker version and say which part is the client and which is the server
    • Fix "Cannot connect to the Docker daemon" by starting Docker
    • Name one alternative to Docker Desktop and when you might use it
  2. Step 2: Images, containers and registries

    Most of your daily Docker work is pulling images, running containers and cleaning up after them. Getting fluent with these commands now means later topics like Compose and Kubernetes feel familiar instead of magic.

    Time: 1–2 weeks. Skip if you can pull an image, run it in the background with a published port, read its logs, and push your own image to a registry.

    Topics

    Images vs containers
    An image is a read-only template (like a recipe or a class), and a container is a running copy of it (like a meal or an object). You can start many containers from one image, and deleting a container does not delete the image. Docker docs: What is an image? Course: Docker Crash Course for Absolute Beginners [NEW] (Docker Images vs Containers) Video: Docker Crash Course #3 - Images & Containers
    docker run
    docker run creates and starts a container from an image, pulling the image first if you don't have it. Its flags set the name (--name), ports (-p), environment variables (-e) and auto-cleanup (--rm), so it is the command you will type most. docker container run reference Docker docs: Running containers Course: Docker Crash Course for Absolute Beginners [NEW] (Main Docker Commands - Pull and Run Docker containers) Video: 8 Basic Docker Commands || Docker Tutorial 4
    Publishing ports
    A container has its own private network, so a web server inside it can't be reached until you publish a port, for example -p 8080:80 (host port 8080 to container port 80). Most "it runs but I can't open it in the browser" problems are a missing or wrong port mapping. Docker docs: Publishing and exposing ports Course: Docker Crash Course for Absolute Beginners [NEW] (Port Binding) Video: Free Docker Fundamentals Course - Docker networking - modes and port exposure
    Detached & interactive
    Use -d to run a container in the background (detached) for servers, and -it to get an interactive terminal inside it, for example docker run -it ubuntu bash. Knowing which mode you are in stops you from accidentally killing a server with Ctrl+C. Docker docs: Foreground and background Course: Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers (Run) Video: Docker Crash Course #7 - Starting & Stopping Containers
    Container lifecycle
    A container moves through states: created, running, paused, stopped (exited) and removed. You manage it with docker ps, stop, start, restart and rm, and a stopped container keeps its data until you remove it. docker container ls reference docker container rm reference Course: Docker Crash Course for Absolute Beginners [NEW] (Start and Stop containers) Video: Docker Crash Course #9 - Managing Images & Containers
    Image tags & digests
    A tag is a human name for an image version, like nginx:1.27, and it can be moved to point at a new build. A digest (sha256:...) is the unique fingerprint of exact image content and never changes. Avoid relying on :latest because it can change under you. docker image tag reference docker image pull: pull by digest Course: Docker Crash Course for Absolute Beginners [NEW] (Docker Image Versions) Video: STOP using Docker Image TAGS | Digests and Digital Signatures explained
    Docker Hub
    Docker Hub is the default public registry, the place docker pull looks unless you say otherwise. It hosts official images (nginx, postgres, python) and your own repositories. Anonymous pulls are rate-limited per IP address, so log in with a free account to get a higher limit. Docker Hub docs Docker docs: What is a registry? Course: Docker Crash Course for Absolute Beginners [NEW] (Docker Registries) Video: Docker Crash Course #4 - Parent Images & Docker Hub
    Pushing images
    To share an image, tag it with your registry and username (yourname/app:1.0), run docker login, then docker push. This is how images move from your laptop or CI pipeline to the servers that run them. Docker docs: Build, tag, and publish an image docker image push reference Course: Complete Docker Course - From BEGINNER to PRO! (Learn Containers) (Container registries) Video: Docker Crash Course #13 - Sharing Images on Docker Hub
    GitHub Container Registry (alternative)
    GHCR (GitHub Container Registry, ghcr.io) stores images next to your code on GitHub and works well with GitHub Actions. Public images are free. An alternative to Docker Hub; pick one. GitHub docs: Working with the Container registry Course: Complete Docker Course - From BEGINNER to PRO! (Learn Containers) (Container registries) Video: Push Docker Images to GitHub Container Registry • #docker #containers #github #githubactions
    Amazon ECR (alternative)
    Amazon ECR (Elastic Container Registry) is AWS's private image registry, used when your containers run on AWS services like ECS or EKS. Access is controlled with AWS IAM. An alternative to Docker Hub; pick one. Amazon ECR: What is Amazon ECR? Pushing a Docker image to ECR Course: Docker Tutorial for Beginners [FULL COURSE in 3 Hours] (Private Docker Repository - Pushing our built Docker Image into a private Registry on AWS) Video: How to push docker image to AWS ECR | Elastic Container Registry | Docker | AWS Devops Tutorials
    Docker Official Images (optional)
    Docker Official Images are a curated set of base images on Docker Hub (like python, node and postgres) that are maintained, documented and regularly patched. Start from them instead of random community images when you can. Docker docs: Docker Official Images Video: How to Use the Apache httpd Docker Official Image
    Cleaning up (optional)
    Old containers, images, volumes and build cache slowly fill your disk. docker system df shows what is using space, and docker system prune (plus image/volume prune) removes unused items. Read the warning first: pruning volumes deletes data. Docker docs: Prune unused objects Course: Complete Docker Course - From BEGINNER to PRO! (Learn Containers) (Interacting with Docker objects) Video: Docker tip: docker system prune and df

    Project: Run a database and a web server

    Run nginx and postgres in the background with names and published ports, connect to postgres with psql inside the container, then stop, remove and prune everything. Push a re-tagged nginx image to your own Docker Hub or GHCR account and pull it back on Play with Docker.

    Common mistakes

    • Deploying images tagged latest and expecting the same version. latest is just a default tag name and can point to a new image at any time. Use a version tag like 1.4.2, or a digest (sha256:...) for an exact, unchangeable image.
    • Forgetting -p, then wondering why the app is unreachable. A container's ports are closed to the outside until you publish them. Use -p 8080:80 to map host port 8080 to container port 80, and make the app listen on 0.0.0.0, not 127.0.0.1.
    • Letting stopped containers and old images fill the disk. Use --rm for throwaway containers and run docker system df to see what takes space. Clean up regularly with docker image prune and docker container prune.

    You're ready to move on when you can

    • Run a container in the background and open it in the browser
    • Explain why deleting a container does not delete its image
    • Tell a tag from a digest and say why :latest is risky
    • Push an image to a registry and pull it on another machine
  3. Step 3: Dockerfiles, layers and builds

    Running other people's images is step one; building your own is the real skill. A good Dockerfile gives you small, fast, cache-friendly builds, which saves minutes on every CI run.

    Time: 2 weeks. Skip if you can write a multi-stage Dockerfile for your own app, explain layer caching, and keep secrets and junk out of the build with .dockerignore.

    Topics

    Writing a Dockerfile
    A Dockerfile is a text file of step-by-step instructions that docker build turns into an image. Each step starts from the previous result, so the file reads like a setup script for your app. Dockerfile reference Docker docs: Writing a Dockerfile Course: Docker Tutorial for Beginners [FULL COURSE in 3 Hours] (Dockerfile - Building our own Docker Image) Video: Build YOUR OWN Dockerfile, Image, and Container - Docker Tutorial
    FROM, RUN, COPY
    FROM picks the base image, RUN executes commands at build time (like installing packages), COPY adds your files, WORKDIR sets the folder and EXPOSE documents the port. These five instructions cover most beginner Dockerfiles. Docker docs: Dockerfile overview Course: Docker Crash Course for Absolute Beginners [NEW] (Dockerfile - Dockerize Node.js app) Video: Dockerfile creation Tutorial - Dockerfile Instructions Explained with example!
    CMD vs ENTRYPOINT
    Both set what runs when the container starts. CMD is a default that is easy to override on the docker run line; ENTRYPOINT is the fixed main program, and CMD then supplies its default arguments. Use the JSON (exec) form so signals like Ctrl+C reach your app. Dockerfile reference: ENTRYPOINT Course: Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers (CMD vs ENTRYPOINT) Video: Docker for Beginners - Commands vs Entrypoint - Kubernetes
    Layers & build cache
    RUN, COPY and ADD create layers, and Docker reuses unchanged layers from cache. Put things that rarely change (installing dependencies) before things that change often (copying source code) so rebuilds take seconds instead of minutes. Docker docs: Understanding image layers Docker docs: Build cache Course: Complete Docker Course - From BEGINNER to PRO! (Learn Containers) (Building container images) Video: Docker Crash Course #8 - Layer Caching
    .dockerignore
    A .dockerignore file lists files Docker should not send into the build, like node_modules, .git and .env. It makes builds faster, images smaller, and stops secrets from being copied into an image by accident. Docker docs: .dockerignore files Course: Complete Docker Course - From BEGINNER to PRO! (Learn Containers) (Building container images) Video: Docker Crash Course #6 - dockerignore
    Multi-stage builds
    A multi-stage build uses one stage with all the compilers and tools to build your app, then copies only the finished output into a small final image. The result is often 5 to 10 times smaller and has far fewer things an attacker could use. Docker docs: Multi-stage builds Course: Complete Docker Course - From BEGINNER to PRO! (Learn Containers) (Building container images) Video: Docker Multi-Stage Builds - Fast and Efficient Dockerfiles
    ARG and ENV
    ARG is a variable that exists only while building (for example a version number), and ENV sets an environment variable that stays inside the running container. Never put passwords in either, because they are saved in the image history. Docker docs: Build variables Video: Docker Environment Variables Full Guide: Build Time vs Runtime variables (ARG, ENV, Secrets)
    Choosing a base image
    Your base image decides the size and security of everything above it. Prefer official images with a pinned version and a small variant like -slim or -alpine; Alpine is tiny but uses musl instead of glibc, which can break some Python and Node packages. Docker docs: Base images Docker docs: Building best practices Course: Complete Docker Course - From BEGINNER to PRO! (Learn Containers) (Building container images) Video: Docker Image BEST Practices - From 1.2GB to 10MB
    docker init (optional)
    docker init asks a few questions about your project and writes a starter Dockerfile, compose.yaml and .dockerignore that follow good practices. Handy for learning what a solid Dockerfile looks like, but read and understand what it generates. docker init reference Video: Docker Init Explained: Your Shortcut to Effortless Containerization
    HEALTHCHECK (optional)
    A HEALTHCHECK instruction tells Docker how to test that your app is really working (for example by calling a /health URL), so docker ps shows healthy or unhealthy instead of just "running". Compose can then wait for a healthy database before starting the app. Dockerfile reference: HEALTHCHECK Video: How (and Why) to Add a Docker Container Health Check? | | Dockerfile HEALTHCHECK CMD Command
    Dive (optional)
    Dive is a free tool that shows every layer of an image and which files each one added. It helps you find what is making an image big and spot wasted space. Good to know when you start optimising. Dive on GitHub Video: Dive | Explore layers inside Docker image | Productivity | Tech Primers

    Project: Containerise your own app

    Take a small app you wrote (Python, Node or Go) and write a multi-stage Dockerfile with a .dockerignore. Record the image size before and after multi-stage, and show in your README that changing one source file rebuilds in seconds thanks to layer caching.

    Common mistakes

    • Copying all source code before installing dependencies. Copy the dependency file (package.json, requirements.txt) and install first, then copy the rest. Docker reuses cached layers, so dependencies only reinstall when that file changes.
    • Building images without a .dockerignore file in the project. Add .dockerignore listing .git, node_modules, .env and build output. This keeps secrets out of the image and makes builds faster.
    • Shipping compilers and build tools in the final image. Use a multi-stage build: compile in one stage, then copy only the finished app into a small runtime image. The image gets smaller and has fewer things to attack.

    You're ready to move on when you can

    • Write a Dockerfile from scratch without copying one
    • Reorder a Dockerfile so dependency installs stay cached
    • Explain when to use CMD and when to use ENTRYPOINT
    • Cut an image's size at least in half with a multi-stage build
  4. Step 4: Volumes, mounts and networking

    Containers are throwaway by design: delete one and its files are gone. Volumes keep your data safe, and Docker networks let containers find and talk to each other, which every real multi-container app needs.

    Time: 1–2 weeks. Skip if you can keep database data across container restarts, choose between a volume and a bind mount, and make two containers talk by name on a user-defined network.

    Topics

    Container filesystem
    Each container gets a thin writable layer on top of its read-only image. Anything written there disappears when the container is removed, which is why databases and uploads must live in a volume or mount instead. Docker docs: Storage overview Course: Complete Docker Course - From BEGINNER to PRO! (Learn Containers) (Understanding container data and docker volumes) Video: Free Docker Fundamentals Course - Docker Storage - Writable Layer, Bind Mounts & Volumes
    Volumes
    A volume is storage managed by Docker that lives outside any one container, so data survives restarts, upgrades and removal. Use named volumes for databases and anything you can't lose, for example -v pgdata:/var/lib/postgresql for PostgreSQL 18 and newer (older images used /var/lib/postgresql/data). Docker docs: Volumes Course: Docker Tutorial for Beginners [FULL COURSE in 3 Hours] (Docker Volumes - Persist data in Docker) Video: Docker Volumes explained in 6 minutes
    Bind mounts
    A bind mount connects a folder from your computer straight into a container, so edits on your laptop show up instantly inside it. Great for development with live reload; for production data, prefer volumes. Docker docs: Bind mounts Course: Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers (Storage) Video: What is Docker Volume | How to create Volumes | What is Bind Mount | Docker Storage
    Bridge networks
    By default containers join a private bridge network on the host and reach the outside world through it. Docker has other drivers too (host, none, overlay), but the bridge is what you use for almost everything on one machine. Docker docs: Networking overview Course: Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers (Networking) Video: Docker Networking Tutorial (Bridge - None - Host - IPvlan - Macvlan - Overlay)
    Container DNS
    On a user-defined network (docker network create mynet), containers can reach each other by name, like http://api:3000, thanks to Docker's built-in DNS. Never hard-code container IP addresses; they change every restart. Docker docs: Bridge network driver (user-defined bridges) Course: Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers (Networking) Video: How Docker Networking Actually Works
    tmpfs mounts (optional)
    A tmpfs mount stores files only in memory and never writes them to disk, and they vanish when the container stops. Useful for temporary files or sensitive data you don't want saved anywhere. Docker docs: tmpfs mounts Course: Complete Docker Course - From BEGINNER to PRO! (Learn Containers) (Understanding container data and docker volumes) Video: Docker Volumes Explained: Bind Mount vs Named Volume vs tmpfs
    Backing up volumes (optional)
    Volumes protect data from container removal, not from disk failure or a bad prune. A simple backup runs a throwaway container that mounts the volume and saves it into a tar file on the host; test restoring it too. Docker docs: Back up, restore, or migrate volumes Video: Migrate Docker Volumes from one Host to another // backup and restore My short: Your Backup Is Useless Until You Test This
    Host & none networks (optional)
    The host network makes a container share the host's network directly (no port mapping, Linux only), and none gives it no network at all. Overlay and macvlan exist for multi-host and special cases; know they exist and learn them when you need them. Docker docs: Host network driver Docker docs: Network drivers Course: Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers (Networking) Video: Docker Networking Tutorial, ALL Network Types explained!

    Project: App plus database on a private network

    Create a user-defined network and run postgres with a named volume plus a small web app that connects to it by container name. Delete and recreate the postgres container to prove the data survives, then back up the volume to a tar file and restore it.

    Common mistakes

    • Storing database data inside the container's own filesystem. The container's writable layer is deleted with the container. Mount a named volume at the data path. For the official postgres image 18 and newer that is -v pgdata:/var/lib/postgresql; older versions used /var/lib/postgresql/data.
    • Connecting containers with localhost or hard-coded IP addresses. Inside a container, localhost means that container only. Put containers on the same user-defined bridge network and connect by container or service name, which Docker's DNS resolves.
    • Never testing restores of volume backups. Back up volumes by running a temporary container that archives the volume to a file, then restore it into a fresh volume to prove it works. For databases, prefer the database's own dump tool.

    You're ready to move on when you can

    • Keep database data after removing and recreating its container
    • Choose a volume or a bind mount for a given situation and explain why
    • Make two containers talk by name instead of IP
    • Explain why an app works with -p but not from another container on localhost
  5. Step 5: Docker Compose

    Real apps are several containers: a web app, a database, a cache. Docker Compose describes them all in one file so the whole stack starts with one command, which is how most teams run apps locally.

    Time: 1–2 weeks. Skip if you can write a compose.yaml for an app plus database with volumes, environment variables and a healthcheck, and start and stop it with one command.

    Topics

    compose.yaml basics
    Compose reads a compose.yaml file that lists your services (containers), their images or build folders, ports and volumes. Use the docker compose command (Compose v2, built into Docker); the old docker-compose v1 tool is retired, and the top-level version: key is obsolete, so leave it out. It replaces long docker run commands with a short file you can commit to Git and share with your team. Docker Compose overview Compose application model Course: Ultimate Docker Compose Tutorial (From Docker Commands To Compose File) Video: Docker Compose Tutorial - Docker in Practice || Docker Tutorial 9
    Compose commands
    docker compose up -d starts everything, down stops and removes it, logs -f follows output, ps lists services and exec opens a shell in one. Note it is "docker compose" with a space now; the old docker-compose tool is retired. docker compose CLI reference Course: Ultimate Docker Compose Tutorial (Docker Compose Commands (Up and Down vs Start and Stop)) Video: Docker Compose in 12 Minutes
    Compose networks & volumes
    Compose automatically puts all services on one network, so your app reaches the database simply as db. You declare named volumes at the bottom of the file so data survives docker compose down (unless you add -v). Compose: Networking Compose file: Volumes Course: Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers (Compose) Video: Docker Compose will BLOW your MIND!! (a tutorial)
    depends_on & healthchecks
    depends_on sets start order, but "started" is not "ready": a database may need extra seconds to accept connections. Add a healthcheck to the database and use condition: service_healthy so the app waits until it is actually ready. Compose: Control startup order Course: Ultimate Docker Compose Tutorial (Control Startup Order) Video: Docker Compose Control Container Order with depends_on
    Environment variables
    Apps read settings like database URLs from environment variables. In Compose you set them with environment: or env_file:, and a .env file next to compose.yaml fills in ${VARIABLES}. Add .env to .gitignore so real values never reach Git. Compose: Set environment variables Compose: Variable interpolation Course: Ultimate Docker Compose Tutorial (Variables in Docker Compose) Video: How to use Docker .env file
    Secrets basics
    Passwords and API keys should not sit in plain environment variables or inside images. Compose secrets mount a secret as a file at /run/secrets/<name>, which is safer and is how many official images (like postgres) expect them. Compose: Secrets Course: Ultimate Docker Compose Tutorial (Docker Compose Secrets) Video: The Best Way to Manage .env Variables in Docker (Compose, Secrets & More)
    Compose Watch (optional)
    Compose Watch syncs your code changes into running containers, or rebuilds them, as soon as you save a file. It gives a fast edit-and-refresh loop without messy bind mounts. Nice for development. Compose: Use Compose Watch Video: Docker Compose Watch: Hot Reload & Rebuild Explained (2025 Tutorial)
    Compose profiles (optional)
    Profiles let you mark some services (like a debug tool or admin UI) to start only when asked, for example docker compose --profile tools up. Good to know once your compose file grows. Compose: Using profiles Video: Docker Compose v2 and Profiles Are the Best Thing Ever

    Project: Three-service stack in one file

    Write a compose.yaml for a web app, a Postgres database and Redis (or Adminer), with named volumes, a .env file, a database healthcheck and depends_on with service_healthy. Anyone should be able to clone your repo and run docker compose up -d to get it working.

    Common mistakes

    • Using depends_on and assuming the database is ready. Plain depends_on only waits for the container to start. Add a healthcheck to the database and use condition: service_healthy so the app waits until it actually accepts connections.
    • Committing a .env file full of real passwords. Add .env to .gitignore and commit a .env.example with placeholder values. Use Compose secrets or a secrets manager for anything sensitive.
    • Running docker compose down -v without knowing what it deletes. The -v flag removes named volumes, which can wipe your database. Use plain docker compose down to stop services and keep the data.

    You're ready to move on when you can

    • Start and stop a multi-container app with one command
    • Explain why depends_on alone does not mean the database is ready
    • Keep real passwords out of Git while still using Compose
    • Read logs from just one service in a running stack
  6. Step 6: Image security basics

    Many images in the wild run as root and ship known vulnerabilities from their base image. A few habits (non-root users, small images, scanning, no secrets inside) remove much of that risk and come up often in DevOps interviews.

    Time: 1 week. Skip if your images run as a non-root user, use a small pinned base image, contain no secrets, and you scan them with Trivy or Docker Scout before pushing.

    Topics

    Run as non-root
    By default a container process runs as root, so if an attacker breaks in they start with full power inside it. Create a normal user in your Dockerfile and switch with USER, and make sure your app only needs to write to folders that user owns. Dockerfile reference: USER Best practices: USER Course: Complete Docker Course - From BEGINNER to PRO! (Learn Containers) (Container security) Video: Running Docker Containers as a Non-root User with a Custom UID / GID
    Pin image versions
    Use exact tags like python:3.13-slim (or a digest) instead of python or :latest, so the same Dockerfile builds the same image next month. Then update on purpose, for example with Dependabot or Renovate, rather than by surprise. Best practices: Pin base image versions Video: Top 8 Docker Best Practices for using Docker in Production
    No secrets in images
    Anything you COPY, ARG or ENV into an image can be read by anyone who pulls it, even if a later step deletes it. Pass build-time secrets with BuildKit secret mounts. At runtime, prefer secrets mounted as files (Compose or Kubernetes secrets) over environment variables, which leak easily into logs and docker inspect. Docker docs: Build secrets Video: docker: secrets at build time! (intermediate) anthony explains #544
    Trivy
    Trivy is a free, open-source scanner that lists known vulnerabilities (CVEs) in an image's OS packages and app libraries, plus leaked secrets. Run trivy image myapp:1.0 locally and in CI, and fix the critical and high findings first. Trivy docs: Container image scanning Video: All-In-One Open Source Security Scanner | Docker Image Analysis with Trivy
    Docker Scout (alternative)
    Docker Scout is Docker's own image analysis, built into Docker Desktop and the CLI (docker scout cves). It lists vulnerabilities and suggests a better base image to fix them. An alternative to Trivy; pick one. Docker Scout docs Video: Find Vulnerabilities Fast! New Docker CLI Command: Docker Scout
    Distroless images (optional)
    Distroless images contain only your app and its runtime, with no shell or package manager, so there is very little for attackers to use or for scanners to flag. The trade-off is harder debugging, since you can't exec a shell into them. Google distroless on GitHub Video: what is a distroless container?
    Docker Hardened Images (optional)
    Docker Hardened Images are minimal, regularly patched base images from Docker with very few known vulnerabilities, signed and with an SBOM (software bill of materials). Good to know as a drop-in safer base for your Dockerfiles. Docker Hardened Images docs Video: Docker’s Best Security Feature Is Now FREE
    Rootless mode (optional)
    Rootless mode runs the Docker daemon itself as a normal user, so even a container escape does not give root on the host. Podman works this way by default. Good to know for shared servers. Docker docs: Rootless mode Video: The Concept Behind Rootless Docker
    Capabilities & read-only (optional)
    Linux capabilities split root's power into small pieces; --cap-drop ALL removes the ones your app doesn't need. --read-only makes the container's filesystem unchangeable. Together they shrink what an attacker can do. Docker docs: Engine security docker run: --read-only Course: Complete Docker Course - From BEGINNER to PRO! (Learn Containers) (Container security) Video: Container Security Fundamentals - Linux Capabilities (Part 1)

    Project: Harden and scan your image

    Take your image from step 3, scan it with Trivy and save the report. Switch to a pinned slim or distroless base, add a non-root user and remove anything secret, then scan again and put the before/after numbers in your README.

    Common mistakes

    • Running containers as root by default. Add a non-root USER in your Dockerfile. If someone breaks into the app, they don't get root on the container.
    • Passing secrets with ARG or ENV in the Dockerfile. Build arguments and environment values are saved in image history and visible with docker history or inspect. Use BuildKit secret mounts (RUN --mount=type=secret) for build time and inject secrets at runtime.
    • Scanning images once and never again. New vulnerabilities (CVEs) are published for old packages every day. Scan in CI with Trivy or Docker Scout on every build, and rebuild regularly to pick up patched base images.

    You're ready to move on when you can

    • Prove your container runs as a non-root user with docker exec id
    • Scan an image and explain one critical finding
    • Explain why deleting a secret in a later RUN step does not remove it
    • Pick a smaller base image and measure the difference
  7. Step 7: Debugging and BuildKit

    Containers fail in new ways: they exit instantly, can't reach each other, or run out of memory. A short list of debugging commands solves most of these, and knowing BuildKit and buildx lets you build faster and for any CPU.

    Time: 1–2 weeks. Skip if you can find why a container keeps restarting using logs, exec and inspect, and you can build an image for both amd64 and arm64 with buildx.

    Topics

    docker logs
    docker logs shows what a container printed to stdout and stderr, and -f follows it live. When a container exits right after starting, the reason is almost always in its last few log lines, so check logs first. docker container logs reference Docker docs: View container logs Course: Docker Tutorial for Beginners [FULL COURSE in 3 Hours] (Debugging a Container) Video: Debugging Docker Containers with docker exec and docker logs || Docker Tutorial 5
    docker exec
    docker exec runs a command inside a running container, and docker exec -it name sh gives you a shell to look around: check files, environment variables and whether another service is reachable. It only works while the container is running. docker container exec reference Course: Docker Tutorial for Beginners [FULL COURSE in 3 Hours] (Debugging a Container) Video: Docker - Tutorial 7 - Run a Command in a Running Container with exec
    docker inspect
    docker inspect prints everything Docker knows about a container, image, volume or network as JSON: its IP, mounts, environment, exit code and health. Use --format to pull out one value, like the exit code of a crashed container. docker inspect reference Course: Complete Docker Course - From BEGINNER to PRO! (Learn Containers) (Interacting with Docker objects) Video: Using Docker Inspection like a Boss
    Restart policies
    A restart policy (--restart unless-stopped or on-failure) tells Docker to start a container again after a crash or a reboot. It keeps simple servers running, but a container stuck in a restart loop means you should go read its logs. Docker docs: Start containers automatically Course: Complete Docker Course - From BEGINNER to PRO! (Learn Containers) (Running containers) Video: Restart Stopped Containers (Restart Policies) - Docker Development Tips & Tricks
    BuildKit
    BuildKit is the modern build engine behind docker build (on by default since Docker 23). It runs independent steps in parallel, caches smarter and supports features like secret mounts and cache mounts. Most build features you read about today assume BuildKit. Docker docs: BuildKit Video: Docker BuildKit Tutorial: Why do we need a new Docker Builder?
    docker buildx
    docker buildx is the CLI for BuildKit's extra features: separate builders, multi-platform builds, exporting cache and pushing straight to a registry. In CI you will often see docker buildx build --push. docker buildx reference Docker docs: Builders Video: Docker BuildX: Level-Up Your Container Game with Multi-Architecture Magic
    docker stats (optional)
    docker stats shows live CPU, memory, network and disk use for each container, like top for containers. Use it to spot a memory leak or a container hitting its limit (exit code 137 often means it was killed for using too much memory). docker container stats reference Video: Docker Stats Command Tutorial: Monitor Container Resource Usage in Real-Time
    Docker Debug (optional)
    docker debug attaches a toolbox shell (with tools like curl and vim) to any container, even slim or distroless ones that have no shell of their own. It comes with Docker Desktop, not plain Docker Engine on Linux. Handy when docker exec says "sh: not found". docker debug reference Video: Debugging Distroless Containers with Docker Debug
    Multi-platform images (optional)
    Laptops with Apple Silicon and many cloud servers use ARM CPUs, while others use x86 (amd64). buildx can build one image for both with --platform linux/amd64,linux/arm64, so it runs everywhere. Learn it when you hit an "exec format error". Docker docs: Multi-platform builds Video: How to Build Multi-Architecture Docker Images with BuildX | Deploy containers to x86 and ARM!
    Build cache in CI (optional)
    CI runners start empty, so without help every build starts from zero. BuildKit can export and import cache (to a registry or the GitHub Actions cache) so CI builds reuse layers just like your laptop does. Docker docs: Cache storage backends Docker docs: Cache with GitHub Actions Video: docker: fast CI rebuilds with --cache-from (intermediate) anthony explains #448

    Project: Break it, then fix it

    Break your Compose stack on purpose in four ways (wrong env var, wrong port, missing volume permission, too-low memory limit) and write down which command showed you the cause. Then build your image for amd64 and arm64 with buildx and push it to your registry.

    Common mistakes

    • Trying to debug a crashed container by exec-ing into it. docker exec only works on running containers. Read docker logs <name> first, and check the exit code and OOMKilled status with docker inspect.
    • Setting restart: always on an app that crashes at startup. The container just loops forever and hides the real error. Fix the crash using the logs first, then use restart: unless-stopped or on-failure for real recovery.
    • Building on an ARM Mac and deploying to x86 servers. An image built on Apple Silicon is arm64 by default and fails with 'exec format error' on amd64 hosts. Use docker buildx build --platform linux/amd64,linux/arm64 to build for both.

    You're ready to move on when you can

    • Find why a container exits immediately using logs and inspect
    • Open a shell in a running container and test a connection from inside
    • Explain what exit code 137 usually means
    • Build and push one image for two CPU platforms
  8. Step 8: Next steps: CI and orchestration

    Docker on one machine is the foundation; in real jobs images are built by pipelines and run by orchestrators across many servers. This step connects what you learned to CI/CD and Kubernetes so you know exactly where to go next.

    Time: 1–2 weeks. Skip if your images are built and pushed by a CI pipeline, and you can explain what Kubernetes adds on top of Docker.

    Topics

    Docker in CI
    A CI pipeline (like GitHub Actions) can build your image, scan it and push it to a registry on every push to main. This turns "works on my machine" into a repeatable, reviewed process and is the usual first DevOps task with Docker. Docker docs: GitHub Actions GitHub docs: Publishing Docker images Video: GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker
    Why orchestration?
    On one server Docker is enough, but with many servers you need something to place containers, restart them, scale them and route traffic. That job is called orchestration, and Kubernetes is the most common tool for it. Kubernetes docs: Overview Course: Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers (Container Orchestration) Video: Kubernetes vs. Docker: It's Not an Either/Or Question
    Kubernetes intro
    Kubernetes runs your container images across a cluster of machines, keeping the number of copies you asked for running and replacing failed ones. It uses the same images you build with Docker, so everything here carries over. Learn it after Docker, not before. Kubernetes basics tutorial Course: Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers (Kubernetes) Video: Kubernetes Explained in 100 Seconds My short: Don't Learn Kubernetes Yet (Do This First)
    Containers vs Pods
    Kubernetes does not run containers directly; it runs Pods, which wrap one or more containers that share a network and storage. Most Pods hold a single container, so think of a Pod as "a container plus Kubernetes settings". Kubernetes docs: Pods Video: Containers vs Pods My short: Container vs Pod in 30 Seconds
    Local Kubernetes
    Tools like kind (Kubernetes in Docker) and minikube run a small Kubernetes cluster on your laptop for free, and Docker Desktop and Rancher Desktop can enable one too. It is the safest place to try your first deployment. kind quick start minikube start Video: Minikube and Kubectl explained | Setup for Beginners | Kubernetes Tutorial 17
    Amazon ECS (alternative)
    Amazon ECS (Elastic Container Service) is AWS's simpler container orchestrator, and with Fargate you don't manage any servers. Many small teams use it instead of Kubernetes. An alternative to Kubernetes; pick one. Amazon ECS: What is Amazon ECS? Video: An Overview of AWS Elastic Container Service (ECS)
    Docker Swarm (optional)
    Docker Swarm is Docker's built-in orchestrator: it turns several Docker hosts into one cluster using compose-like files. It is simple but used much less than Kubernetes today, so learn it only if a job or homelab needs it. Docker docs: Swarm mode Course: Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers (Docker Swarm) Video: Docker Swarm Mode: EASY Tutorial

    Project: From push to registry to cluster

    Add a GitHub Actions workflow that builds your image with buildx, scans it with Trivy and pushes it to GHCR when you push to main. Then start a kind cluster and run your image there with kubectl create deployment and kubectl expose.

    Common mistakes

    • Running CI builds without any layer cache. Every build then starts from scratch and takes much longer. Use buildx cache options such as --cache-from and --cache-to with type=gha or type=registry.
    • Jumping to Kubernetes before an app runs well in Compose. Kubernetes adds many new concepts on top of containers. Get the image small, configurable through environment variables and healthy in Compose first, then move it.
    • Pushing images to production with no tag tracking the commit. Tag each image with the Git commit SHA or a release version as well as any moving tag. That way you can tell exactly what is running and roll back to a known image.

    You're ready to move on when you can

    • Show a green pipeline that pushed a fresh image tag
    • Explain what Kubernetes does that Docker alone does not
    • Explain the difference between a container and a Pod
    • Run your own image on a local Kubernetes cluster

Capstone project: Production-ready containerised app

Take a small web app with a database and ship it the way a team would: a multi-stage, non-root Dockerfile, a compose.yaml with volumes, a healthcheck and secrets, and a GitHub Actions pipeline that builds a multi-platform image, scans it with Trivy and pushes it to GHCR. Finish by running the same image on a local kind cluster. Document the image size, scan results and how to run it in your README.

Certifications

  1. Docker Certified Associate (DCA): Still offered, now run by Mirantis (not Docker Inc.): 55 questions in 90 minutes, USD 199. A big part covers Docker Swarm and enterprise tooling, so it is optional; your projects matter more to employers.
  2. Kubernetes and Cloud Native Associate (KCNA): A good next step after this roadmap: a beginner multiple-choice exam on Kubernetes and cloud native basics. Do the Kubernetes roadmap next.

Frequently asked questions

How long does it take to learn Docker?

About 2–3 months at 8 hours a week to go from zero to confidently Dockerising your own apps with Compose. You can run your first container in an afternoon; the projects are what make it stick.

Do I need to know Linux before learning Docker?

Basic terminal skills are enough to start: moving between folders, editing files and reading errors. Containers are Linux under the hood, so learning a bit more Linux (permissions, processes, networking) alongside Docker makes debugging much easier.

Is Docker Desktop free?

Yes for personal use, education, open-source projects and small businesses (under 250 employees and under USD 10 million revenue). Larger companies need a paid plan. Podman and Rancher Desktop are free alternatives with almost the same commands.

Should I learn Docker or Kubernetes first?

Docker first. Kubernetes runs the same container images you build with Docker, so without understanding images, ports, volumes and networking, Kubernetes errors will make little sense. Spend a few weeks with Docker and Compose, then move on.

What is the difference between Docker and a virtual machine?

A virtual machine runs a whole operating system on virtual hardware, while a container shares the host's kernel and only packages the app and its files. Containers start in seconds and use much less memory; VMs give stronger isolation. Most cloud setups use both: containers running on VMs.

Is there a Docker certification?

Yes, the Docker Certified Associate (DCA), now run by Mirantis. It is optional and covers a lot of Docker Swarm, so for most beginners a GitHub portfolio of Dockerised projects, followed by Kubernetes certs like KCNA or CKA, is a better use of time and money.

Other roadmaps