postgresql - Load Postgres dump after docker-compose up -


i have dump.sql file load docker-compose.

docker-compose.yml:

services:   postgres:     environment:       postgres_db: my_db_name       postgres_user: my_name       postgres_password: my_password     build:       context: .       dockerfile: ./devops/db/dockerfile.db 

my dockerfile.db simple @ moment:

from postgres maintainer me <me@me.me>  copy ./devops/db ./devops/db workdir ./devops/db 

i run command psql my_db_name < dump.sql @ point. if run script dockerfile.db, issue script run after build before docker-compose up, , database not running yet.

any idea how ?

reading https://hub.docker.com/_/postgres/, section 'extend image' explains .sql in /docker-entrypoint-initdb.d executed after build.

i needed change dockerfile.db to:

from postgres  add ./devops/db/dummy_dump.sql /docker-entrypoint-initdb.d 

and works!


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -