Docker Assignments — Build. Ship. Operate.

Move from first container to production-grade workflows. Each topic-wise set includes 20 Basic, 20 Intermediate, and 10 Advanced questions so learners can practice deliberately and level up fast.

Your seven attached assignments span: Core Concepts, Images & Networking, Volumes & Data Persistence, Docker Compose, CI/CD & DevOps, Orchestration with Swarm, and Best Practices.

Why practice with these assignments?

  • Go beyond theory—install Docker, run/inspect containers, manage images, logs, and exec end-to-end.
  • Build real-world skills in Dockerfiles, tagging, bridges/host/macvlan/overlay networks, and image registries.
  • Make data durable with volumes, bind mounts, backups, and restores (including MySQL).
  • Model multi-service apps with Compose and scale/services health checks.
  • Wire containers into CI/CD pipelines across Jenkins/GitLab/GitHub Actions.
  • Operate at cluster level with Swarm stacks, secrets, updates, and resource limits—plus security, scanning, and monitoring.

How it works

  • Open any assignment and attempt questions in order: Basic → Intermediate → Advanced.
  • Run locally (Docker Desktop or Docker Engine/CLI); keep notes of commands, outputs, and screenshots.
  • Validate every step (container status, logs, ports, volumes, network connectivity, pipeline logs).
  • Save a short “what I learned” note per task—syntax, reasoning, and gotchas.

What you’ll achieve

  • Confident use of images/containers, lifecycle commands, logs/exec/inspect.
  • Fluency with Dockerfiles, tagging, and bridge/host/custom networks.
  • Durable data with named volumes, bind mounts, backups & restores.
  • Production-style Compose stacks: scale, healthchecks, env/volumes, and overrides.
  • CI/CD proficiency: build → test → scan → push → deploy pipelines.
  • Swarm operations: services/stacks, updates/rollbacks, secrets, resource limits.
  • Solid security & observability: non-root, scans, logging drivers, cAdvisor/Prometheus/Grafana.

Browse the Assignments

  • Assignment 1 — Docker Core Concepts: install, hello-world, run/stop/start/rm, images vs containers, logs/exec/inspect, stats, save/load, push.
  • Assignment 2 — Images & Networking: Dockerfiles, layers & tags, custom/bridge/host/macvlan/overlay, ports, multi-net containers, pushing/pulling custom images.
  • Assignment 3 — Volumes & Data Persistence: named volumes vs bind mounts, multi-container sharing, MySQL persistence, backup/restore strategies.
  • Assignment 4 — Multi-Container with Compose: services, networks, volumes, env, scaling, healthchecks, reverse proxy, prod overrides.
  • Assignment 5 — Docker in CI/CD & DevOps: pipelines for build/tag/push/run, multi-stage images, registry auth, caching, vulnerability scans, deploy steps.
  • Assignment 6 — Orchestration & Advanced Features (Swarm): services/stacks, scaling/updates/rollbacks, secrets, resource limits, overlay networks, service logs.
  • Assignment 7 — Best Practices: non-root, seccomp/AppArmor, Content Trust, scans (docker scan/Trivy), logging & monitoring (ELK/Fluentd, Prometheus/Grafana), Podman/Buildah comparisons.

Tips for success

  • Prefer small, cache-friendly Dockerfiles and use .dockerignore to shrink build context.
  • Choose the right network mode per use case (bridge/host/macvlan/overlay) and verify connectivity with curl/ping.
  • Make data durable: named volumes for portability; bind mounts for live-editing source; back up volumes regularly.
  • Model multi-service apps with Compose; validate with docker compose ps/logs/config before scaling.
  • In pipelines, scan images, push with clear tags, and publish artifacts/logs for triage.
  • For clusters, adopt healthchecks, resource limits, rolling updates, and rollbacks.

Ready to build real confidence in Docker? Pick a set below and start solving!

FAQs

Q1. Docker Desktop or Docker Engine—what should I use for these tasks?
Either option works. Docker Desktop simplifies setup on Windows and macOS, while Docker Engine on Linux is closer to production servers. The core tasks like run, logs, exec, and inspect work the same.

Q2. How do I verify a containerized web app is actually reachable?
Map container ports to host ports using -p, then test with curl localhost:<port> or open the app in a browser. Compose and Networking assignments include full end-to-end verification steps.

Q3. Volumes vs bind mounts—when should I use each?
Use volumes for portable, managed data and backups. Use bind mounts when you need live code changes from the host reflected in the container. You’ll compare persistence and behavior across both.

Q4. I rebuilt my image but nothing changed—why?
Docker’s layer caching may be reusing build steps. To fix this, reorder layers (copy dependencies before app code) or bust the cache intentionally. The Images assignment explores caching, layers, and tagging in detail.

Q5. What’s the minimal path to multi-service development?
Write a docker-compose.yml file with services, networks, and volumes. Use docker compose up -d, scale services as needed, and validate using docker compose ps and logs.

Q6. How do I keep data safe for databases like MySQL?
Mount a named volume at the database data path. Practice backup and restore using temporary containers and tar archives, then test recovery to confirm reliability.

Q7. Do we cover CI/CD integration (Jenkins/GitLab/GitHub Actions)?
Yes. You’ll set up pipelines that build, tag, and push images, use multi-stage builds, apply caching and security scans, and add deploy steps after successful builds.

Q8. Swarm vs single-host Compose—what’s the difference here?
Compose orchestrates services on a single host. Swarm schedules services across multiple nodes with features like secrets, rolling updates, and rollbacks. You’ll practice using both approaches.

Q9. How do I harden containers for production?
Run containers as non-root, drop unnecessary capabilities, use seccomp or AppArmor profiles, enable Docker Content Trust, and scan images with docker scan or Trivy. Monitor containers using cAdvisor, Prometheus, and Grafana.

Q10. How much time should I allocate per assignment?
Plan 30–60 minutes per assignment. More advanced tasks such as Compose stacks, CI/CD integration, or Swarm operations may take longer—focus on correctness and observability first.