All Articles
DockerDevOpsTooling

The Docker Compose Dev Setup I've Used for 3 Years

March 30, 2026
7 min read

The Docker Compose Dev Setup I've Used for 3 Years

Local dev environments are personal. After iterating for years, here's mine — and why each choice was made.

The Core Principle

Everything runs in containers. The host machine has only: Docker, a code editor, and git. No version conflicts, no "works on my machine."

The Compose File

services:
  app:
    build: .
    volumes:
      - .:/app
      - /app/node_modules
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=development
    depends_on:
      - postgres
      - redis
  
  postgres:
    image: postgres:16-alpine
    volumes:
      - pg_data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: myapp
      POSTGRES_PASSWORD: dev_password
  
  redis:
    image: redis:7-alpine

volumes:
  pg_data:

Key Insights

1.Volume mount node_modules at a separate mount point — prevents host/container conflicts
2.Alpine images — dramatically smaller, faster pulls
3.Named volumes for databases — survive docker compose down without losing data