Compose: Docker Compose depending on another Docker Compose

Created on 22 Sep 2016  路  3Comments  路  Source: docker/compose

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?

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).

All 3 comments

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).

Was this page helpful?
0 / 5 - 0 ratings