K
K
kirillinyakin2020-10-04 22:52:31
PostgreSQL
kirillinyakin, 2020-10-04 22:52:31

How can a table be created on Docker Postgres Image initialization?

Hello everybody! How can I create a table on the initialization of a Docker container with Postgres?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2020-10-04
@kirillinyakin

Everything is very simple. Go to the container documentation, here is the address https://hub.docker.com/_/postgres
there look for the item Initialization scripts , everything
is described there script what you need to do when you first start the container and place it in a certain place in the container (mount it as a volume), start the container, create a base there, after the container starts your script - creates users, tables, rights, uploads data, etc.

E
Eugene, 2020-10-04
@Nc_Soft

What for? The base is created, then migrations are launched, they create tables.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question