PostgreSQL Docker Image
The EnvyGeeks PostgreSQL docker image is a simple docker image that assumes you want to get shit done rather than fight with horse shit, and it doesn't make an ass of itself by assuming you don't know how to work PostgreSQL.
docker run --name postgresql \ -v /srv/docker/volumes/postgresql/srv/postgresql:/srv/postgresql \ -dit envygeeks/postgresql
When you first boot it, it will setup PostgreSQL and everything the way that Debian does without need for your intervention, then once it's booted you can start doing the real work.
You create all that the same way you do on your own system. With
createuser --interactive, the reason I do it this way is because I don't make the assumption you want one PostgreSQL per Docker instance, that and that's bad for memory and bad for development. We scale our PostgreSQL and even use Docker to create snapshots.
docker exec -it postgresql chpst -u postgres createuser --interactive user docker exec -it postgresql chpst -u postgres createdb --owner=user db docker exec -it postgresql chpst -u postgres psql -c \ "ALTER USER user WITH password 'password'"
Creating users, databases and extensions.
To create a set of default users, passwords and databases or users/databases then create mount the volume (file) to
/usr/share/postgresql/default/users and if we detect it we will parse it with the following syntax:
To create extensions on databases create
/usr/share/postgresql/default/extensions and in that file use the following syntax: