Evolution of Compose

In the early days when Docker Compose was developed in Python, it supported extends, which allowed services and environments to be managed separately, meeting complex environmental requirements.

After Docker Compose migrated from Python to Go, this feature was no longer supported. Instead, modular orchestration was achieved by specifying multiple service orchestration files using the -f parameter.

However, this approach wasn’t very user-friendly. If service A depended on B, and you happened not to specify the configuration file containing B using the -f parameter, Compose execution would fail!

Include Feature

Starting with Docker Compose version 2.20, the new include feature is supported, which is similar to extends but with some differences.

As you can see, using include allows you to integrate compose orchestration files and env environment variables:

Official Example

This allows complex project orchestration files to be split into multiple smaller files, enhancing the reusability of service orchestration!

I hope this is helpful, Happy hacking…