Let's say I have system A started by a compose file A_compose, let's say I want to start system A from compose file B which also does other stuff.
Can I execute a compose file in another directory using the top level compose file?
You can use the extends attribute
in your docker compose file.
Docker Compose's extends attribute lets you share common configurations among different files, or even different projects entirely.
If you have a common-services.yml
:
services:
webapp:
build: .
ports:
- "8000:8000"
volumes:
- "/data"
You can then reuse common-services.yml
in another docker compose file:
services:
web:
extends:
file: common-services.yml
service: webapp
Read the documentation for more information.
docker compose up
, but I think that would be a lot of work for little gain.