Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support defining profiles on includes #12296

Open
jalaziz opened this issue Nov 15, 2024 · 2 comments
Open

Support defining profiles on includes #12296

jalaziz opened this issue Nov 15, 2024 · 2 comments

Comments

@jalaziz
Copy link

jalaziz commented Nov 15, 2024

Description

The ability to "include" a compose file into a parent file is incredibly powerful for supporting modular compose configurations. However, a key missing feature is the ability to add a global profile to the included file from the parent compose file.

Our use case is having multiple the ability to split a super compose file into separate child compose files, but allowing control over which child compose files are started by default. For example, we have a parent compose file that spins up most of the stack needed for resting. However, we have a separate compose file for the components related to our internal dashboard (this includes frontend, backend, and agent services). We would like the ability to optionally start the dashboard services from the main compose file when needed.

While we could define the profile on services in the "child" compose file, this is not desirable as then the child compose file can no longer be independently used without always starting the profile.

The ideal solution would be to add profiles as a configuration key alongside path under include and automatically extend all services from the included configuration with the defined profiles.

@ndeloof
Copy link
Contributor

ndeloof commented Nov 15, 2024

IIUC you'd like to have an optional dashboard.yaml included as you run docker compose --profile dashboard up
Can't you just run explicitly this sibling compose file as docker compose -f compose.yaml -f dashboard.yaml up ?

@jalaziz
Copy link
Author

jalaziz commented Nov 16, 2024

Can't you just run explicitly this sibling compose file as docker compose -f compose.yaml -f dashboard.yaml up ?

Sure, but there may be many such things and the ergonomics of knowing and discovering what you can use can be complicated (e.g. dashboard.yaml could be in some nested subfolder). Also, things get extra complicated if we want to have services in compose.yaml that potentially depend on services within dashboard.yaml but are all started under the same profile.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants