intermediate

Docker

Build, run, network, and compose containers with reproducible images and environment-aware local development workflows.

Docker interviews focus on reproducible images, disposable containers, efficient builds, local multi-service stacks, and networking that mirrors production assumptions.

Subtopics: images, containers, Dockerfile, layers, multi-stage builds, volumes, networks, Docker Compose.

On interviews: design a production Node.js image with lockfile install, non-root user, multi-stage build, and explain compose health checks versus `depends_on`.

Common pitfalls: secrets in layers; `latest` in prod; localhost confusion between services; compose diverging from deploy manifests.

The trade-off is developer convenience versus image safety and environment parity.

Checklist:

  • Build from lockfiles with intentional layer order.
  • Keep runtime images small and scannable.
  • Externalize durable state.
  • Align local compose with deploy networking.