Load Postgres dump after docker-compose up

后端 未结 5 1840
广开言路
广开言路 2021-02-02 12:42

I have a dump.sql file that I would like to load with docker-compose.

docker-compose.yml:

services:
  postgres:
    environment:
      POSTGRES_DB: my_d         


        
5条回答
  •  [愿得一人]
    2021-02-02 13:02

    After the docker-compose up, do docker ps it will give you a list of active docker containers. From that, you can get the container ID.

    Then,

    docker exec -i {CONTAINER_ID} psql -U {USER} < {.SQL FILE}

提交回复
热议问题