← All insightsConcepts

Docker: core concepts and configuration explained

CodeWizard Academy · 27 September 2026 · 3 min read · Beginner

Package an app and its dependencies into a portable image that runs the same everywhere. This walkthrough covers the mental model and the configuration you will actually touch.

Docker builds, ships and runs applications inside containers - isolated processes that bundle the code, runtime and libraries so 'works on my machine' stops being a problem.

The configuration that matters

A small, cache-friendly multi-stage Dockerfile for a Node service.

dockerfile
# syntax=docker/dockerfile:1
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM node:20-alpine AS run
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
USER node
EXPOSE 3000
CMD ["node", "dist/server.js"]

Principles to hold onto

  • Pin base image tags (or digests) instead of :latest for reproducibility
  • Order layers from least- to most-frequently changed to maximize cache hits
  • Use multi-stage builds to keep runtime images tiny and attack surface small
  • Add a HEALTHCHECK and run as a non-root user

Everyday commands

bash
docker build -t myapp:1.0 .
docker run --rm -p 3000:3000 --name myapp myapp:1.0
docker ps
docker logs -f myapp
docker exec -it myapp sh

Want senior help putting Docker to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult