docker-compose.override.yml

Environment-specific overrides for Docker Compose

What is this file?

The docker-compose.override.yml file allows you to customize your Docker Compose configuration for different environments (like development vs production) without modifying the main docker-compose.yml file.

How to Use It

When you run docker-compose up, Docker automatically merges the main configuration with any overrides defined here, allowing environment-specific customizations.

Example Use Case

Customizing port mappings for development, or adding debug containers in testing.

Example Configuration

version: "3.8"

services:
  webapi:
    ports:
      - "5000:80"  # Override port mapping
    environment:
      DEBUG: "true"  # Add development-specific env var
    volumes:
      - /tmp/debug:/app/logs  # Mount debug volume

Best Practices