This gist is an example of how you can simply install and run and extended Postgres using docker-compose. It assumes that you have docker and docker-compose installed and running on your workstation.
- Requires
dockeranddocker-compose - Clone via http:
git clone https://gist.github.com/b0b7e06943bd389560184d948bdc2d5b.git - Make
load-extensions.shexecutable - Build the image:
docker-compose build
See docker-compose.yml for details.
I just noticed you can also add SQL files to the
/docker-entrypoint-initdb.d/directory and they'll be executed directly, so no need to create.shfiles for that.In my case I just created a
startup.sqlwith the SQL needed to create my DB and tables, and then copied it on pg-Dockerfile:Now every time I run
docker-compose up, I have a PostgreSQL with my database created on it. :)