Docker for Developers: Containers in Development and Production

Images, Dockerfile, compose, and best practices—run and ship apps with Docker.

Docker standardizes how we run and ship applications. Here’s a practical developer-focused guide.

Docker and containers
Docker and containers

Core concepts

  • Image — Read-only template (OS + app + dependencies). Build from a Dockerfile; store in a registry (Docker Hub, ECR, GCR).
  • Container — Running instance of an image. Isolated process with its own filesystem and network. Ephemeral unless you use volumes.
  • Dockerfile — Instructions to build an image. Use multi-stage builds to keep final image small. Pin base image and versions.
  • Compose — Define multi-container apps in docker-compose.yml. One command to start app + DB + cache. Use for local dev and simple deploys.

Container adoption (teams):

Teams using Docker (%)

Best practices

Use a minimal base image (alpine or distroless). Run as non-root. Don’t store secrets in images; use env or secrets at runtime. Use .dockerignore to speed builds and shrink context. Prefer compose for local; use orchestration (Kubernetes, ECS) for production at scale.

Docker in 100 seconds:

Takeaway

Docker makes “it works on my machine” a thing of the past. Use it for consistent dev and CI; use compose for local stacks. Learn the basics first; add orchestration when you need it.