V
V
vaflya2021-08-03 14:51:10
PostgreSQL
vaflya, 2021-08-03 14:51:10

How to create multiple databases in Postgres automatically?

Good afternoon, there is a project with microservices on node.js.
For example, from docker-compose, I can create 1 database by throwing the database name into environment variables.
The question is how to create multiple databases from docker compose or are there other methods?
ps: Is there a rule that 1 postgres instance = 1 database.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2021-08-03
@ky0

The scope of postgres inside a docker container is quite limited. If you already have several databases, the need to differentiate access between them, or even optimize storage with tablespaces, replication and all sorts of other adult things, then, apparently, it's time to take out the DBMS from containers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question