Use docker-docker container in microservice architecture

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.

Wow, it accelerated. But I wanted to show the research that I have done since I simply cannot believe that it is impossible now.

+5
source share

Source: https://habr.com/ru/post/1274724/


All Articles