Journal / DevOps, Deployment, Infrastructure

DevOps, Deployment, Infrastructure

Containerization: Why Docker Is Still Worth Learning

Containerization is the technique of packaging an application with its dependencies into a portable runtime unit. Docker is the dominant tool. The container makes the development environment, the staging environment, and the production environment identical. The discipline is worth learning deeply because containers are now the substrate for almost every modern deployment. The engineer who treats Docker as a black box misses optimizations and struggles to debug.

What you actually need to know

  • Containers are the substrate for almost every modern deployment.
  • Layer caching is the most important Dockerfile pattern to learn.
  • Multi stage builds reduce image size dramatically.
  • Run as non root. Scan images. Pin versions.
  • Compose is for local development. Use proper orchestration for production.

Pattern

Impact

Layer caching

Build times in seconds vs minutes

Multi stage build

Image size 5 to 10x smaller

Non root user

Smaller security surface

Image scanning

Catches known vulnerabilities

Pinned base image

Reproducible builds

Small base image

Faster push and pull, fewer vulnerabilities

The core argument

Containers feel like solved infrastructure. Most engineers can write a working Dockerfile by copying from Stack Overflow. The container builds. The application runs. The deployment works. The deeper understanding is missing, and the missing understanding shows up at the boundaries. Slow builds. Large images. Security vulnerabilities. Confusing debugging sessions when the container behaves differently from the host.

The engineers who understand Docker deeply ship faster because their builds are fast. They debug better because they understand what a container actually is. They write Dockerfiles that produce small secure images instead of large insecure ones. The depth pays back across every project for the rest of the engineer's career.

The depth is not exotic. A container is a process with some namespacing and a filesystem layer. The image is a stack of read only layers plus a writable layer at the top. The Dockerfile produces the layers. The runtime executes the process with the right namespacing and the right layer stack. Understanding this is a few hours of focused reading.

The patterns that follow from the depth are mechanical. Order Dockerfile instructions so the cache holds. Use multi stage builds to separate build dependencies from runtime dependencies. Pick the right base image for the trade off. Run as a non root user. Scan for vulnerabilities. The patterns become habit after a few projects.

The patterns worth learning

Pattern

Why it matters

COPY package.json first

Dependency layer cached when only source changes

Multi stage build

Final image excludes build tooling

Non root user

Smaller security surface

Distroless or Alpine base

Smaller image, fewer vulnerabilities

Pinned base image tag

Reproducible builds

.dockerignore

Smaller build context, faster builds

Health check

Orchestrator knows when container is ready

Multi arch builds

Same image runs on ARM and x86

How much does this cost

The cost is learning time. Roughly a week of focused work to go from copy paste Dockerfile to deep understanding. The return is faster builds, smaller images, and better debugging across every container project for the engineer's career.

Features the container setup must have

  • Dockerfile with layer order optimized for cache.
  • Multi stage build separating build and runtime.
  • Non root user in the final image.
  • Pinned base image version.
  • .dockerignore that excludes unnecessary context.
  • Health check defined.
  • Image scanning in CI.
  • A clear build process documented.

Expert opinion

Treat containers as a solved black box and the cost shows up quietly: images larger than they need to be, builds that take longer than they should, and a security surface nobody ever audited. Spend a week learning Docker properly and all three problems shrink at once. The investment is one week of focused learning. The return compounds across every container the engineer ever builds.

Yashveer Singh, founder of Yashveer Labs

How this played out on a real project

A client's container images were 1.2 GB each. The CI builds took six minutes. The pushes and pulls were slow. The team had assumed this was normal for their stack.

We audited the Dockerfile. The build dependencies were in the final image. The base image was the full language image rather than a slim variant. The Dockerfile ordering caused cache misses on every source change. The image was running as root.

We rewrote the Dockerfile with multi stage builds. We switched to a slim base image. We reordered the layers for cache reuse. We added a non root user. We added .dockerignore that excluded test data.

The image size dropped to 180 MB. The cached build time dropped to forty seconds. The pushes and pulls became near instant. The security surface shrank. The work took two days. The improvement was permanent.

For more on the related work, see Kubernetes for startups when it makes sense when it does not and AWS ECS vs EKS vs Fargate a SaaS founder comparison.

Common mistakes teams make

  1. Copy pasted Dockerfile with no understanding.
  2. No multi stage build. Build tooling in production image.
  3. Running as root.
  4. Unpinned base image. Reproducibility lost.
  5. Layer order that prevents cache hits.
  6. No .dockerignore. Large build context slows builds.
  7. No image scanning. Vulnerabilities slip through.
  8. Treating Compose as a production tool.

A one week learning plan

  1. Day one. Read about Linux namespaces and cgroups. Understand what a container is.
  2. Day two. Practice writing a Dockerfile with proper layer ordering.
  3. Day three. Implement multi stage builds for an existing project.
  4. Day four. Pick the right base image. Compare sizes.
  5. Day five. Add image scanning, non root user, health check.
  6. Day six. Read about Buildkit. Adopt it for cache improvements.
  7. Day seven. Document your learnings. Apply to every container the team owns.

For more on the related work, read CI caching strategies that cut build times in half and the twelve factor app in 2026 still relevant slightly updated. On the broader infrastructure side, serverless vs containers vs bare metal a cost and flexibility map is the natural next read.

FAQ

Frequently asked

  • Why does Docker still matter in 2026?
  • What is the most important Dockerfile pattern?
  • What is a multi stage build?
  • What about Docker Compose?
  • What is the right base image?
  • How small should the final image be?
  • What about Docker security?

Author

The work I take and why

I take work that compounds. I do not take work that is rework with extra steps. Yashveer Singh, founder of Yashveer Labs. If the topic on this page is what you are dealing with, the question is not whether it can be solved. It can. The question is whether you want to solve it once or four times. I am the person who solves it once.

Start the conversation See the work DM on Instagram