A
A
Alexander2021-05-28 20:30:27
PostgreSQL
Alexander, 2021-05-28 20:30:27

How to populate database data in docker container?

I just started to master docker, the question seems simple, but I don’t know which side to approach
. The application is built in a docker container, the database config is below

services:
    db:
        image: postgres:11.2
        container_name: api_db
        restart: always
        volumes:
            - ./data/postgresql:/var/lib/postgresql/data

Periodically, an updated dump arrives with the dump.sql database.
How can I send data to the container?

It is possible to forward ports and use a local postgres server
, but is it possible to do it differently? For the base to rise in a container

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2021-05-28
@alexmixaylov

A database dump in SQL format and what is on the disk of a running postgres are completely different things.
In any case, the dump will need to be somehow loaded into the database. Whether you do this over the network through a forwarded port, or throw the dump into a container and deploy it locally, it doesn't matter.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question