Is there a way for an application with a docker-compose.yml
to depend on another application with docker-compose.yml
?
For instance, let's pretend I have an API in one repo and a UI in another repo. And both have a docker-compose.yml
file and each has it's own set of containers that are required.
Can the UI have some sort of directive that will tell it to load the API and all of it's containers?
Hi!
You should be able to achieve something similar with extends
directives: https://docs.docker.com/compose/extends/#understand-the-extends-configuration
Does extend requires multiple compose files in one repo? In this case, UI and the service will not be in the same repo.
This is a terrible answer, composition is about not know how something is implemented, a docker image and a composite docker image (compose) should be interchangeable without clients knowing that you decided to break your problem into smaller pieces or aggregated a bunch of stuff in a larger unit.
This is why the software industry prefers composition over inheritance (extends).
Most helpful comment
This is a terrible answer, composition is about not know how something is implemented, a docker image and a composite docker image (compose) should be interchangeable without clients knowing that you decided to break your problem into smaller pieces or aggregated a bunch of stuff in a larger unit.
This is why the software industry prefers composition over inheritance (extends).