Run SQL scripts inside Dockerfile

Viewed 10178

I am using next Dockerfile to setup postgres database engine

FROM postgres:9.6.5
ENV POSTGRES_USER postgres
ENV POSTGRES_PASSWORD xxx
ENV POSTGRES_DB postgres
ADD localDump.sql /docker-entrypoint-initdb.d

i need to create ROLE CREATE ROLE read_only; before initializing my database and before running localDump.sql script.

So how can i run SQL scripts inside Dockerfile direct?

1 Answers
Related