Skip to main content

Docker

Docker packages applications and their dependencies into containers.

What Is Docker

Docker containers provide a consistent runtime environment across development, testing, and production.

They are useful when an application needs predictable dependencies, services, and deployment behavior.

How To Use Docker

Write a Dockerfile, build an image, and run a container from that image.

Basic Example

FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["npm", "start"]

Common Concepts

  • Images are packaged application snapshots.
  • Containers are running image instances.
  • Volumes persist data.
  • Compose runs multi-service local environments.

What To Learn Next

Learn image layers, Docker Compose, networking, volumes, registries, and production container security.