Of the questions tagged by docker , I assume that StackOverflow is the right place for the request (instead of DevOps ), if not, point me to the right place or move this question accordingly.
My scenario is as follows:
- several applications consisting of a web GUI and a backend (REST services) are developed after SOA / approaches to microservices, each application has its own git repository
- Some applications require a common additional resource, such as frontend, for an HTTP server, and for several backend applications, a database server (with persistent storage) is required.
- the main attention is paid to autonomous mobile development (on the road), therefore, it is necessary to provide quick configuration of the necessary services / applications, and the amount of resources should be minimal. But, of course, all this will be deployed / published at some point, so I do not want to prevent this if both can be controlled.
- development is done for windows and linux host machines.
- Access to all services from the host machine is required for development purposes.
I am trying to get the docker-compose.yaml in the application repositories that I call through docker-compose up , which then starts all the necessary containers if it doesnβt work already , for example the database container starts when I call docker-compose up in the backend application repository .
My approach was to have a new git repository that defines all shared docker-compose.yaml files / containers with their own docker-compose.yaml , where all developers had to run docker-compose build whenever something changed (can be automated with using git to capture in the future). The central docker-compose.yaml as follows
version: "3" services: postgres: build: ./images/postgres image: MY-postgres container_name: MY-postgres-server ports: - "5432:5432" httpd: build: ./images/httpd image: MY-httpd container_name: MY-httpd-server ports: - "80:80"
Dockerfile describing how each image is built is in its own subfolder, and I think this does not apply to the issue, mostly the default images for alpine + apache / postgres.
So the problem: what would docker-compose.yaml look like in the git application repository, which refers to the services / containers defined by the aforementioned central docker-compose.yaml .
Now, since no new , I did some research and, frankly, the variety of approaches and proposed solutions was confusing, this time with different versions and compatibility, legacy features, etc.
- We want one database instance now for reasons of performance and simplicity ( reddit ), or this is a problem because it really counts as an anti-pattern (via this answer ). Each application will use its own database in the container, so synchronization is not required at the application level.
- I read about volumes or only data containers to solve this problem, but I cannot figure out how to implement
- Some (single-host scripts) offer links (with
depends_on ), while I think this concept has been replaced with networks , but is it still applied? It seemed extends as well docker-compose has the --no-deps option, which is described as Don't start linked services. . If I omitted this, I would suggest that it does what I need, but here I think that then the problem is the difference in the value of image / container / service- Can a combination of several composable files solve this problem? This will add a strict requirement to the project path , although
- If I can not start the containers from the directory of my application, the identifier, at least to link to them, is
external_links the right approach ? - There are some feature requests ( function: including external docker-compose.yml , allow sharing containers through services ), or maybe it is just not possible at the moment with docker tools? Then, how to solve a problem with a third-party, for example dcao include (which does not support
version 3 )?
Wow, it accelerated. But I wanted to show the research that I have done since I simply cannot believe that it is impossible now.