Postgres docker image with database creation?
Currently I am struggling to have a postgres docker image which automatically generates a database.
Doing this right now
3 Replies
I also have a start-dev-db.sh script which runs that yaml file
Right now the docker container is built correctly I just want to add a database to it
you can create a db service in your docker-compose like so:
For this to work, you will also need this script:
./project-root/init-postgres.sh
Note that I use this with gitlab CD/CI, so you will probably need to change/remove some of the env variables, but this is just to get the idea.
Hope it helps.
If its for local you can give postgres a default sql script to run on startup