Good day.
There is an idea to deploy two services in a docker on the same host using DBMS, which can also be deployed in a docker.
If you solve the task without a docker, then a single DBMS service would be raised on the host, two databases created (one for each target service), two users, one for each created database, a DBMS would be exposed to the outside port (3306 for MySQL and 5432 for postgres), and the target services would be configured to connect to the corresponding database.
I try to solve the same problem with the help of docker (specifically with the help of docker-compose). In all examples, a single DBMS and one service using a DBMS via a link are described in docker. It seems that, if necessary, raising two services using the same DBMS, for each service you need to raise two instances of the DBMS service.
Of course, when creating a docker container for a DBMS service, it is possible to prescribe code that creates databases and users with psql, but nowhere on the Internet have such examples / descriptions / recommendations been found, which is why I get the impression that I want something strange and nobody does.
- Do I understand correctly that raising several services of the same DBMS on one host is the norm?
- And otherwise, if you still should not create several DBMS services on one host, how should this problem be solved?
Please help find the answers to these questions.