🌍 DevOps · subject

DevOps Docker Syllabus

The Docker syllabus for DevOps in full: 4 chapters, 14 topics and 60 sub-topics, every one listed below, plus 60 Docker flashcards with answers.

4Chapters
14Topics
60Sub-topics
60Flashcards

Docker syllabus: all 4 chapters

Expand any chapter to see its topics and sub-topics.

  1. Introduction to Docker

    3 topics
    • What is Docker?
      • History of Docker
      • Docker vs Virtual Machines
      • Benefits of Docker
    • Docker Architecture
      • Docker Daemon
      • Docker Client
      • Docker Registries
      • Docker Images
      • Docker Containers
    • Installing Docker
      • Installation on Windows
      • Installation on macOS
      • Installation on Linux
      • Post-installation Steps
  2. Docker Basics

    3 topics
    • Docker CLI
      • Basic Commands
      • Managing Images
      • Managing Containers
      • Docker Help
    • Docker Images
      • Understanding Docker Images
      • Creating Docker Images
      • Dockerfile Basics
      • Best Practices for Writing Dockerfiles
    • Docker Containers
      • Understanding Containers
      • Running Containers
      • Stopping and Restarting Containers
      • Removing Containers
  3. Advanced Docker Concepts

    4 topics
    • Docker Networking
      • Container Networking Basics
      • Bridge Networks
      • Overlay Networks
      • Host Networks
      • Custom Networks
    • Docker Volumes
      • Introduction to Volumes
      • Creating and Managing Volumes
      • Volume Drivers
      • Bind Mounts vs Volumes
    • Docker Compose
      • Introduction to Docker Compose
      • Defining Services in Compose
      • Networking in Compose
      • Volumes in Compose
      • Scaling Services
    • Docker Swarm
      • Introduction to Docker Swarm
      • Setting up a Swarm Cluster
      • Deploying Services in Swarm
      • Swarm Networking
      • Scaling and Updating Services
  4. Docker in Production

    4 topics
    • Security
      • Docker Security Best Practices
      • Securing Docker Daemon
      • Securing Docker Images
      • Securing Docker Containers
    • Monitoring and Logging
      • Monitoring Docker Containers
      • Logging in Docker
      • Using Third-party Monitoring Tools
      • Using Third-party Logging Tools
    • CI/CD with Docker
      • Integrating Docker with CI/CD Pipelines
      • Using Docker in Jenkins
      • Using Docker in GitLab CI
      • Using Docker in GitHub Actions
    • Orchestration with Kubernetes
      • Introduction to Kubernetes
      • Kubernetes vs Docker Swarm
      • Running Docker Containers in Kubernetes
      • Kubernetes Networking
      • Kubernetes Storage

DevOps Docker flashcards — 60 questions with answers

  1. What is Docker?

    Docker is an open-source platform for developing, shipping, and running applications inside lightweight, portable containers that package an application together with all its dependencies, libraries, and configuration.

  2. What core problem does Docker solve?

    It solves the 'it works on my machine' problem by ensuring an application runs identically across environments (dev, test, prod), because the container bundles everything the app needs to run.

  3. How does a container differ from a virtual machine (VM)?

    A container virtualizes the OS and shares the host kernel, packaging only the app and its dependencies (megabytes, starts in seconds). A VM virtualizes hardware and includes a full guest OS via a hypervisor (gigabytes, starts in minutes).

  4. Which Linux kernel features underpin Docker container isolation?

    Namespaces (provide isolation of processes, network, mounts, users, etc.) and cgroups (control groups, which limit and account for resource usage like CPU and memory). Union filesystems provide layered images.

  5. Name the main components of the Docker architecture.

    The Docker daemon (dockerd), the Docker client (CLI), the REST API connecting them, container images, containers, and a registry (e.g., Docker Hub) for storing/distributing images.

  6. What is the role of the Docker daemon (dockerd)?

    It is the persistent background server process that builds, runs, and manages Docker objects (images, containers, networks, volumes) and listens for Docker API requests from clients.

  7. How does the Docker client communicate with the daemon?

    The client (docker CLI) sends commands to the daemon through the Docker REST API, over a UNIX socket or a network interface. The client and daemon can run on the same or different hosts.

  8. What is containerd in the Docker architecture?

    containerd is the high-level container runtime that the Docker daemon uses to manage the container lifecycle (image transfer, container execution, supervision). It in turn uses runc as the low-level OCI runtime to actually create containers.

  9. What is a Docker registry?

    A registry is a storage and distribution system for Docker images. Docker Hub is the default public registry; organizations can run private registries. Commands push images to and pull images from registries.

  10. What command verifies a Docker installation is working?

    docker run hello-world — it pulls a test image and runs it, printing a confirmation message. docker --version or docker info also report installation details.

  11. What is Docker Desktop?

    Docker Desktop is an application for Mac, Windows, and Linux that provides the Docker Engine, CLI, Docker Compose, a GUI, and a Linux VM, making it the standard way to install and run Docker on non-Linux developer machines.

  12. On Linux, why might you add your user to the 'docker' group after installing?

    Membership in the docker group lets you run docker commands without sudo. Otherwise the docker CLI requires root because the daemon's socket is owned by root.

  13. What is the general syntax of a Docker CLI command?

    docker [OPTIONS] COMMAND [ARG...], for example docker run -d -p 80:80 nginx. Newer Docker uses management commands like docker container ls and docker image ls.

  14. What does 'docker ps' show, and how do you see stopped containers?

    docker ps lists currently running containers. Adding the -a (or --all) flag shows all containers including stopped ones.

  15. What is the difference between 'docker run' and 'docker start'?

    docker run creates a new container from an image and starts it. docker start starts an existing, previously created (stopped) container without creating a new one.

  16. What is a Docker image?

    A Docker image is a read-only template containing the application code, runtime, libraries, and dependencies. Containers are created from images; an image is built from a Dockerfile and composed of stacked layers.

  17. What are image layers and why do they matter?

    An image is made of stacked read-only layers, each produced by an instruction. Layers are cached and shared between images, which speeds up builds and reduces storage and transfer size.

  18. What is a Dockerfile?

    A Dockerfile is a text file containing a sequence of instructions (FROM, RUN, COPY, CMD, etc.) that Docker reads to automatically build an image.

  19. What does the FROM instruction in a Dockerfile do?

    FROM sets the base image for subsequent instructions; it must be (in most cases) the first instruction. Example: FROM ubuntu:22.04. Use FROM scratch for an empty base.

  20. Compare the CMD and ENTRYPOINT instructions in a Dockerfile.

    ENTRYPOINT defines the executable that always runs and is hard to override; CMD provides default arguments or a default command that is easily overridden by arguments to docker run. They are often combined: ENTRYPOINT sets the program, CMD sets default args.

Show the other 40 Docker flashcards
  1. Difference between the COPY and ADD instructions?

    COPY simply copies local files/directories into the image. ADD does the same but additionally can extract local tar archives and fetch remote URLs. Best practice favors COPY unless ADD's extra features are needed.

  2. What command builds an image from a Dockerfile and tags it?

    docker build -t name:tag . — the -t flag tags the image, and the final '.' is the build context (the directory sent to the daemon).

  3. What is a multi-stage build and why use it?

    A multi-stage build uses multiple FROM stages in one Dockerfile, copying only needed artifacts from a build stage into a smaller final image. It produces lean production images by excluding build tools and dependencies.

  4. What is the purpose of a .dockerignore file?

    It lists files and directories to exclude from the build context sent to the daemon, reducing build time and image size and preventing secrets or unnecessary files from being copied in.

  5. What is a Docker container?

    A container is a runnable instance of an image — an isolated process with its own filesystem, networking, and resources. You can create, start, stop, move, and delete containers, and multiple containers can run from one image.

  6. What is the writable container layer?

    When a container starts, Docker adds a thin writable layer on top of the read-only image layers. All changes (new/modified files) are written there; this layer is deleted when the container is removed, so data is not persisted unless a volume is used.

  7. Difference between 'docker stop' and 'docker kill'?

    docker stop sends SIGTERM for a graceful shutdown, then SIGKILL after a grace period (default 10s). docker kill sends SIGKILL immediately, forcibly terminating the container.

  8. How do you run a command inside a running container?

    docker exec -it <container> <command>, e.g. docker exec -it mycontainer /bin/bash to open an interactive shell. The -it flags allocate an interactive TTY.

  9. What is the difference between detached and foreground container mode?

    Detached mode (-d) runs the container in the background and returns the container ID. Foreground (default) attaches the container's stdout/stderr to the terminal so you see its output live.

  10. How do you publish a container port to the host?

    Use -p hostPort:containerPort with docker run, e.g. docker run -p 8080:80 nginx maps host port 8080 to container port 80. Use -P to publish all exposed ports to random host ports.

  11. List the main Docker network drivers.

    bridge (default for standalone containers), host (shares the host's network stack), none (no networking), overlay (connects containers across multiple hosts in a swarm), and macvlan (assigns a MAC/IP making containers appear as physical devices).

  12. What is the default network driver for a standalone container?

    The bridge driver. Containers on the default bridge can reach each other by IP; on a user-defined bridge they can also resolve each other by container name via Docker's embedded DNS.

  13. What advantage does a user-defined bridge network have over the default bridge?

    User-defined bridges provide automatic DNS resolution between containers by name, better isolation, and the ability to attach/detach containers on the fly — features the default bridge lacks.

  14. When would you use the host network driver?

    When you want a container to share the host's network namespace directly (no network isolation), removing port-mapping overhead for maximum network performance. It is Linux-only and ports are taken directly from the host.

  15. What is the overlay network driver used for?

    It creates a distributed network spanning multiple Docker daemon hosts, allowing containers (and swarm services) on different hosts to communicate securely as if on one network. It is the standard for Docker Swarm multi-host networking.

  16. Why are volumes preferred over storing data in the container's writable layer?

    Volumes persist data independently of the container lifecycle (data survives removal), can be shared among containers, offer better performance, and are managed by Docker, whereas the writable layer is deleted with the container.

  17. Compare Docker volumes and bind mounts.

    Volumes are stored in a Docker-managed area of the host filesystem (/var/lib/docker/volumes) and are fully managed by Docker. Bind mounts map any arbitrary host path into the container and depend on the host's directory structure. Volumes are the recommended mechanism.

  18. What is a tmpfs mount?

    A tmpfs mount stores data in the host's memory only (not on disk). It is non-persistent and removed when the container stops; useful for sensitive or temporary data that should not be written to disk. Linux-only.

  19. What command creates a named volume and how is it attached?

    docker volume create mydata creates it; attach with docker run -v mydata:/path/in/container ... (or --mount source=mydata,target=/path).

  20. What is Docker Compose?

    Docker Compose is a tool for defining and running multi-container applications using a single YAML file (compose.yaml / docker-compose.yml). It lets you configure all services, networks, and volumes and start them with one command.

  21. What command starts and stops a Compose application?

    docker compose up (add -d for detached) starts all services defined in the Compose file; docker compose down stops and removes the containers, networks, and (optionally) volumes it created.

  22. In a Compose file, what do the 'services', 'volumes', and 'networks' top-level keys define?

    services defines the containers (images, ports, env, dependencies); volumes declares named volumes for persistent data; networks declares custom networks that services can join. By default Compose also creates one network for the project.

  23. What does the 'depends_on' key control in Compose?

    It controls the startup/shutdown order of services, ensuring a service starts after its dependencies. Note: it waits for the container to start, not for the service inside to be 'ready' (use healthchecks/conditions for readiness).

  24. What is Docker Swarm?

    Docker Swarm is Docker's native clustering and orchestration tool that turns a group of Docker hosts into a single virtual host, enabling deployment, scaling, and management of services across multiple nodes.

  25. What are the two node roles in a Docker Swarm?

    Manager nodes (maintain cluster state, schedule tasks, and handle orchestration via the Raft consensus algorithm) and worker nodes (execute the tasks/containers assigned by managers). A node can be both.

  26. In Swarm, what is the relationship between a service, a task, and a container?

    A service is the definition of the desired state (image, replicas). The service is divided into tasks, and each task is the scheduling slot that runs exactly one container. Replicas = number of tasks/containers.

  27. How does Swarm achieve high availability of the cluster state?

    Manager nodes use the Raft consensus algorithm to replicate cluster state. A majority (quorum) of managers must be available; to tolerate $f$ manager failures you need $2f+1$ managers.

  28. Name three Docker security best practices.

    Run containers as a non-root user, use minimal/official trusted base images and scan them for vulnerabilities, drop unneeded Linux capabilities, keep images updated, use read-only filesystems, and never bake secrets into images (use Docker secrets).

  29. Why should containers avoid running as root, and how do you change the user?

    Running as root increases the blast radius if the container is compromised, since the container root can map to host root in some configs. Use the USER instruction in the Dockerfile (or --user at runtime) to run as a non-root, least-privilege user.

  30. What are Docker secrets and namespaces' role in security?

    Docker secrets securely store and deliver sensitive data (passwords, keys) to swarm services without embedding them in images or env vars. Namespaces isolate each container's processes/network/users, and user namespaces can remap container root to an unprivileged host user.

  31. How do you view a container's logs and what is the default logging driver?

    docker logs <container> (add -f to follow). The default logging driver is json-file, which writes stdout/stderr to JSON files on the host; other drivers include local, syslog, journald, fluentd, and awslogs.

  32. What command shows a live stream of container resource usage statistics?

    docker stats — it displays a live view of CPU %, memory usage/limit, network I/O, and block I/O for running containers. docker top shows the processes running inside a container.

  33. What is a common stack for monitoring and logging Dockerized applications?

    For metrics, Prometheus + cAdvisor + Grafana (collection, container metrics, dashboards). For centralized logs, the ELK/Elastic Stack (Elasticsearch, Logstash, Kibana) or EFK (with Fluentd).

  34. How does Docker fit into a CI/CD pipeline?

    CI builds a Docker image from the committed code, runs tests inside containers for consistent environments, then pushes the tagged image to a registry; CD pulls that immutable image and deploys it to staging/production, ensuring identical artifacts across stages.

  35. Why are Docker images well-suited as CI/CD deployment artifacts?

    Images are immutable, versioned (by tag/digest), and self-contained, so the exact artifact tested in CI is the one deployed — eliminating environment drift and enabling reliable rollbacks by redeploying a previous tag.

  36. What is container orchestration and why is it needed?

    Orchestration automates the deployment, scaling, networking, load balancing, health management, and lifecycle of containers across a cluster of machines. It is needed because manually managing many containers across many hosts is impractical.

  37. What is Kubernetes and how does it relate to Docker?

    Kubernetes (K8s) is an open-source container orchestration platform for automating deployment, scaling, and management of containerized applications. It runs Docker-built (OCI) container images across a cluster and is more feature-rich than Docker Swarm.

  38. What is a Pod in Kubernetes?

    A Pod is the smallest deployable unit in Kubernetes — one or more tightly coupled containers that share the same network namespace (IP/port space) and storage volumes, and are always scheduled together on the same node.

  39. Compare Docker Swarm and Kubernetes.

    Swarm is simpler, integrated with Docker, and easy to set up but has fewer features. Kubernetes is more complex with a steeper learning curve but offers richer features (auto-scaling, self-healing, large ecosystem) and is the industry-standard for large-scale orchestration.

  40. What is a Kubernetes Deployment and a Service?

    A Deployment declares the desired state for a set of replica Pods and manages rolling updates and self-healing. A Service provides a stable network endpoint (and load balancing) to access a dynamic set of Pods, since Pod IPs change.

DevOps Docker FAQ

What is in the DevOps Docker syllabus?

DevOps Docker is split into 4 chapters: Introduction to Docker, Docker Basics, Advanced Docker Concepts and Docker in Production. Together they contain 14 topics and 60 sub-topics.

How many chapters are in DevOps Docker?

4 chapters, containing 14 topics and 60 sub-topics. The largest chapter is Advanced Docker Concepts, with 4 topics.

Are there flashcards for DevOps Docker?

Yes — a 60-card Docker deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.