Docker for Node and Next.js apps · mid
Docker in CI and deploys
In CI you build the image once with BuildKit, tag it with the git commit (plus a version), scan it, push it to a registry and deploy that exact image (ideally by digest) to every environment, never a mutable 'latest'.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- docker buildx build with cache export/import (registry or GitHub Actions cache) keeps CI builds fast.
- Tags: an immutable one per build (git SHA) plus readable ones (v1.4.0, main). Deploy by SHA tag or digest so a rollback is a redeploy of an old tag.
- Image reference format: registry/repository:tag@digest. Without a registry, Docker Hub is assumed; official images live under library/ (node = docker.io/library/node).
- Multi-architecture images (linux/amd64 and linux/arm64) matter for AWS Graviton and Apple Silicon.
- Docker Hub limits pulls: 100 per 6 hours for anonymous users (per IP), 200 for free personal accounts. Log in, mirror images, or use a registry pull-through cache (ECR) in CI.
- Scan in the pipeline and fail on critical CVEs; build-time secrets via --secret, never --build-arg.
The red pen
Common traps: mistake → fix
Mistake: Deploy :latest everywhere
Fix: you cannot tell what is running or roll back reliably; latest is just a moving tag.
Mistake: Rebuild per environment
Fix: staging and production may get different dependencies; build once, promote the same image.
Easy to hard
Questions interviewers ask, easy to hard
- How does your CI build and ship Docker images?
- How do you tag images and roll back?
- CI builds suddenly fail with 'toomanyrequests'. Why, and what do you do?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.