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-compose installed and running on your workstation.
- Clone via http:
git clone https://gist.github.com/b0b7e06943bd389560184d948bdc2d5b.git
- Build the image:
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. :)