Using Docker Compose overrides

Resources aren't the only things that change between environments, though. You will also have different configuration settings, different ports being published, different setups for your container health checks, and more. It can be tempting to have completely different Docker Compose files for each environment, but that's something you should try hard to avoid.

Having multiple Compose files means additional overhead to keep them in sync—and, more importantly, there's a risk of environments drifting if they aren't kept in sync. Using Docker Compose overrides addresses this and means your requirements for each environment are explicitly stated.

Docker Compose looks for files called docker-compose.yml and docker-compose.override.yml ...

Get Docker on Windows - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.