Docker Tutorial — Introduction Exercises

2 minute read

Practice what you’ve learned in the Introduction chapter. These exercises cover containers, Docker vs VMs, the Docker ecosystem, and OCI standards.


Exercise 1 — Container vs VM Decision

Scenario: You need to deploy the following workloads. For each, decide whether you’d use a container or a VM, and explain why.

  1. A Python Flask API that needs to scale to 50 instances
  2. A Windows Server running a legacy .NET Framework 4.5 app on a Linux host
  3. A Redis cache for local development
  4. A security-critical multi-tenant workload where each tenant must be fully isolated
  5. A CI/CD build agent that runs tests in a clean environment
Show Answer
  1. Container — Same OS, needs fast scaling, stateless API
  2. VM — Different OS kernel (Windows on Linux), requires full OS
  3. Container — docker run redis is instant, disposable, perfect for dev
  4. VM — Strong isolation needed, shared kernel is a risk for multi-tenant
  5. Container — Clean environment per build, fast startup, ephemeral

Exercise 2 — Identify Docker Components

Question: Match each description to the correct Docker component.

# Description Component
1 Background service that manages containers ?
2 Command-line tool you type docker run into ?
3 Public registry with millions of images ?
4 YAML-based tool for multi-container apps ?
5 Next-generation image builder ?
Show Answer
  1. Docker Daemon (dockerd)
  2. Docker CLI (docker)
  3. Docker Hub
  4. Docker Compose
  5. BuildKit

Exercise 3 — Namespace Matching

Question: Match each Linux namespace to what it isolates.

Namespace Isolates
PID ?
NET ?
MNT ?
UTS ?
Show Answer
Namespace Isolates
PID Process IDs — container sees its own PID 1
NET Network interfaces, IP addresses, ports
MNT Filesystem mount points
UTS Hostname

Exercise 4 — OCI Standards

Question: Answer the following about OCI standards.

  1. What does OCI stand for?
  2. Name the three OCI specifications.
  3. Why were OCI standards created?
  4. What is runc?
Show Answer
  1. Open Container Initiative
  2. Image Spec, Runtime Spec, Distribution Spec
  3. To prevent vendor lock-in and ensure portability — images built with Docker work with Podman, Kubernetes, etc.
  4. runc is the reference implementation of the OCI Runtime Specification — it’s the tool that actually creates and runs containers using Linux kernel features.

Exercise 5 — True or False

  1. A container runs its own OS kernel.
  2. Docker was the first container technology ever created.
  3. Containers typically start in milliseconds to seconds.
  4. A VM can run a different OS than the host.
  5. OCI standards ensure Docker images only work with Docker.
Show Answer
  1. False — Containers share the host kernel
  2. False — chroot (1979), FreeBSD Jails (2000), Solaris Zones (2004), LXC (2008) came before Docker (2013)
  3. True — No OS boot required
  4. True — VMs run their own kernel via hypervisor
  5. False — OCI ensures images work with ANY compliant runtime (Docker, Podman, containerd)

← OCI Standards Installation →

Updated: