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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.