✦ For everyone, free.

Practical knowledge for real and everyday life

Home

12.1.2 Compose Dev Stack

A focused guide to Compose Dev Stack, connecting core concepts with practical Docker and container operations.

A Compose dev stack is the complete collection of services — application, dependencies, and supporting tools — defined together in a development-oriented Compose file, providing everything a developer needs to run and work on a project locally with a single, unified configuration.

Defining the Complete Dev Stack

A development Compose file typically includes the application itself, alongside every dependency it requires.

services:
  app:
    build: .
    volumes:
      - .:/app
    ports:
      - "3000:3000"
    environment:
      - DATABASE_URL=postgres://db:5432/app
    depends_on:
      - db
  db:
    image: postgres:16
    ports:
      - "5432:5432"
  cache:
    image: redis:7

This single file fully describes everything needed to run the application locally for development.

Why a Dedicated Dev-Specific Configuration Often Makes Sense

A development-specific Compose file (or an override layered on top of a base file) can include configuration — bind mounts, exposed database ports for direct local inspection — that wouldn't be appropriate for a production deployment.

services:
  db:
    ports:
      - "5432:5432"

Exposing the database's port directly to the host is convenient for local development (allowing a developer to connect with their own database client) but typically isn't necessary or appropriate in a production context.

Starting the Complete Dev Stack

A single command brings up every defined service together.

docker compose up -d
Why a Complete, Unified Dev Stack Definition Matters

Capturing every aspect of a development environment within one coherent Compose configuration provides a single, reliable source of truth for how to run the project locally, removing ambiguity about what's actually needed and how it should be configured.

Why Compose Dev Stack Matters

A well-organized, complete Compose dev stack definition is foundational to a smooth, low-friction local development experience, consolidating everything a developer needs into one clear, runnable configuration.

Content in this section