You need to save the docker image to the file and then pass them to "on check" on the flash drive. An image with a database must contain a lowered dump.

Try to collect the image from DockerFile:

From Postgres: 12.4-Alpine
Add ./dump/dump.sql /dockeress-ientrypoint-initdb.d.

And then I start it all through Docker-Composel:

Version: '3'
    Image: My_custom_Image.
      PGDATA: /VAR /LIB /PostgreSQL /DATA
      Postgres_DB: $ {db_name}
      Postgres_user: $ {db_user}
      Postgres_password: $ {db_pass}
      -$ {db_port}: 5432

The problem is that the dump rolls every time the container starts, which leads for example, to the fact that the remaining containers may not wait for the dump coming and fall on the database timeout.

How can you roll a dump 1 time so that when the container starts with the base all the data have been filled?

Create a dump that will check the availability of a table /data and will not do anything?

Exploding Kitten2021-06-13 01:47:07

During the image assembly instead of Add ./dump/dump.sql /dockeredrypoint-initdb.d, launch postgres and perform recovery.

Sergey Mitrofanov2021-06-13 01:47:07

+ What is spinning in the "other containers" that fall?

Sergey Mitrofanov2021-06-13 01:47:07

@Sergeymitrofanov there is node.js app with Typeorm and @ NestJS /Typeorm. It is not what falls -it can fall if the dump rolls later than the attempts of the reconnect. My computer takes off more often than it does not take off. But how it will be on a person's computer who will run -FIG knows. The question is shorter in that -how to make an image in which the desired dump will be.

muturgan2021-06-13 01:47:07

The easiest way does not deal with the image device and how to roll a dump there, it is to start to wait for a dump loading, you can delete dump.sql, stop the container, then Git Tag -and you have a ready image with data. Use instead of my_custom_image in the Compose File. More "correct" way, it is to find a command that starts after the start of the container, and run it from DockerFile, so that what is happening when starting, has done once when assembling.

Roman Konoval2021-06-13 01:47:07