How will you customize Docker compose file for different environments?

In Docker compose there are two files docker-compose.yml and docker-compose.override.yml. We specify our base configuration in docker-compose.yml file. For any environment specific customization we use docker-compose.override.yml file.
We can specify a service in both the files. Docker compose will merge these files based on following rules:
For single value options, new value replaces the old value.
For multi-value options, compose will concatenate the both set of values.
We can also use extends field to extend a service configuration to multiple environments. With extends, child services can use the common configuration defined by parent service.

Leave a Reply

Your email address will not be published. Required fields are marked *