Skip to content
Postgres11 with PostGIS and Timescale extensions
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.dockerignore first commit Dec 20, 2018
.gitignore mount the log dir Jan 13, 2019
.travis.yml add docker-push.sh, cleanup Dec 21, 2018
Dockerfile dont daemonize, set permissions for the mountpoint Mar 16, 2019
Makefile
README.md timescale 1.2.2 Mar 14, 2019
docker-entrypoint.sh first commit Dec 20, 2018
docker-push.sh add docker-push.sh, cleanup Dec 21, 2018
pg_hba.conf mount the log dir Jan 13, 2019
postgresql.conf mount the log dir Jan 13, 2019
run-server.sh dont daemonize, set permissions for the mountpoint Mar 16, 2019

README.md

Docker images for Postgres

Build Status

Check out perrygeo/postgres on Dockerhub

This is my take on a Dockerized PostgreSQL 11.1 database with some useful extensions including PostGIS and TimescaleDB. The primary goal is to quickly launch a local postgres server for development, one with reasonablly current versions and built from source.

Futures goals include launching this as a production grade Postgres deployment on AWS and Digitial Ocean. Looking at projects like Patroni for inspiration.

The family tree

debian:stretch-slim
      |
      v
python:3.6-slim-stretch
      |
      v
perrygeo/gdal-base:latest
      |
      V
perrygeo/postgres:latest

See perrygeo/gdal-base for details on the C shared libraries available, notably GDAL, proj and GEOS for use in PostGIS. The following package versions are built from source:

POSTGRES_VERSION 11.2
PROTOBUF_VERSION 3.6.1
PROTOBUF_C_VERSION 1.3.1
POSTGIS_VERSION 2.5.2
TIMESCALE_VERSION 1.2.2

Uses the docker_entrypoint.sh script from the offical postgres image thus most of the best practices described in the documentation also apply to this project.

Using the image locally

make

will pull the base image, build the perrygeo/postgres image, then (re)start the database server in the background with your local pgdata directory mounted for $PGDATA.

Connect with psql

$ psql -U postgres -h localhost -d db

Check postgres logs

The logs live in $PGDATA/pg_log. Since pgdata is mounted to the container, you can see them on your local file system:

$ tail -f pgdata/pgdata11/pg_log/postgresql-...csv

Run commands and login to the running container

docker exec postgres-server {command to execute}

You can use docker exec -it postgres-server /bin/bash to get an interactive shell.

Extending this image

Probably don't. I think you'd have better luck copying this Dockerfile and modifying it according to your needs.

Using it in production

Not yet.

License

Docker image licensing is a mess and in lieu of clear best practices, I'm making the source code and the associated images on dockerhub available as public domain.

I provide no warranty of any kind. You're on your own if you choose to use any of these resources. If the images work for you, great! Please docker pull it, fork it, git clone it, download it, whatever. Thanks to github, travis-ci and dockerhub for donating the computing resources to support open source projects such as this.

Contributing

Ideas for additional drivers or software? Bug fixes? Please create a pull request on this repo with:

  • a description.
  • code + an automated test for the new functionality.
  • results of trying it in production.

If your proposal is aligned with the project's goals, I'll gladly accept it!

You can’t perform that action at this time.