Opscraft
Containers

Docker

Must-know11 lessons · 43 min · 3 tests ·

Docker made containers practical: package an application with its runtime and dependencies into an image, and run it the same way on a laptop, a CI agent, or an EKS node. Most DevOps engineers use it every day; senior interviews go underneath the commands — how images and layers are stored, what a container actually is to the kernel, how BuildKit caching works, how networking is wired with veth pairs and iptables, and how to build images that are small, reproducible and secure enough for a regulated production environment.

Stage 2 · Core tools

Know these first

After this topic you can

  • Write small, secure, cache-friendly Dockerfiles
  • Run, inspect and debug containers
  • Explain images, layers, volumes and container networking

Lessons

  1. 1Containers, VMs and the Docker architecture 5 min read
    • What a container really is
    • Containers vs virtual machines
    • The engine stack
    • OCI standards and Kubernetes
  2. 2Images, layers and registries 3 min read
    • Layers and the union filesystem
    • Tags, digests and manifests
    • Registries and naming
  3. 3Writing Dockerfiles properly 5 min read
    • The instructions
    • ENTRYPOINT vs CMD
    • Exec form vs shell form
    • Build context and .dockerignore
    • How layer caching decides
  4. 4BuildKit, multi-stage builds and CI caching 4 min read
    • Multi-stage builds
    • BuildKit features worth knowing
    • Never put secrets in images
    • Reproducible builds
  5. 5Running containers: lifecycle, resources and logs 3 min read
    • Lifecycle
    • Restart policies
    • Resource limits
    • Init and signals
    • Logging
  6. 6Storage and data 3 min read
    • Three ways to mount data
    • The container's writable layer
    • Databases in containers
    • Disk housekeeping
  7. 7Networking internals 4 min read
    • Bridge networking, step by step
    • Network drivers
    • DNS between containers
    • Subnet clashes
  8. 8Container security 4 min read
    • Defence in depth
    • Supply chain security
    • Debugging minimal images
  9. 9ECR and registry operations 3 min read
    • Pushing to ECR
    • Repository settings to mention
    • Tagging strategy
  10. 10Troubleshooting Docker 4 min read
    • Common failures and fixes
    • A debugging sequence
  11. 11Interview questions and model answers 5 min read
    • "How would you make a Docker image smaller, faster to build and more secure?"
    • "What's the difference between CMD and ENTRYPOINT, and why does exec form matter?"
    • "Explain how a container is isolated."
    • "Your container works on your laptop but fails on an EKS node with exec format error. Why?"
    • "How does layer caching work and how would you speed up a slow CI build?"
    • "Where are secrets safe in a Docker workflow?"
    • "A host's disk keeps filling up with Docker data. What do you do?"
    • "Why tag with the git SHA instead of latest?"
    • "Docker vs containerd vs runc?"