Jonatan Matajonmatum.com
conceptsnotesexperimentsessays
© 2026 Jonatan Mata. All rights reserved.v2.1.1
Concepts

Docker Compose

Tool for defining and running multi-container applications with a YAML file, simplifying local development of systems with multiple services.

seed#docker-compose#docker#local-development#yaml#multi-container#devops

What it is

Docker Compose is a tool for defining and running applications consisting of multiple Docker containers. A compose.yaml file describes all services, networks, and volumes, and a single command brings them all up.

Basic compose.yaml

services:
  web:
    build: .
    ports:
      - "3000:3000"
    depends_on:
      - db
    environment:
      DATABASE_URL: postgres://db:5432/app
  
  db:
    image: postgres:16
    volumes:
      - pgdata:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: app
 
volumes:
  pgdata:

Essential commands

  • docker compose up: bring up all services
  • docker compose up -d: bring up in background
  • docker compose down: stop and remove containers
  • docker compose logs -f: follow logs from all services
  • docker compose exec web sh: shell into a service

Use cases

  • Local microservices development
  • Testing environments with real dependencies
  • Quick demos and prototypes
  • CI/CD for integration tests

Compose vs Kubernetes

AspectDocker ComposeKubernetes
PurposeLocal development, CIProduction, orchestration at scale
ComplexityLow — one YAML fileHigh — multiple resources (Deployments, Services, Ingress)
ScalingManual (scale: 3)Automatic (HPA, VPA)
NetworkingDefault bridge networkCNI plugins, service discovery
StateStateful with local volumesStatefulSets, PersistentVolumes
Migration—Kompose converts compose files to K8s manifests

Why it matters

Docker Compose allows defining multi-container applications as code. For local development, it replaces complex setup scripts with a single command that starts databases, caches, and auxiliary services in the correct order.

References

  • Docker Compose Documentation — Official documentation.
  • Compose File Reference — Docker, 2024. Complete file format reference.
  • Docker Overview — Docker, 2024. General Docker and Compose context.

Related content

  • Docker

    Container platform that packages applications with all dependencies into portable, consistent units that run identically in any environment.

  • Local Development

    Practices and tools for creating productive development environments on the developer's machine, replicating production as closely as possible.

Concepts