Install Hypriot image on the pi as detailed at https://blog.hypriot.com/getting-started-with-docker-on-your-arm-device/
Pull down the postgres image from here https://hub.docker.com/r/tobi312/rpi-postgresql/
This is probably not the best way, but it works! Create a file named start_pg.sh and make it executable:
docker rm postgis
docker run --name postgis -d -p 5432:5432 -v /home/pirate/.local/share/postgresql:/var/lib/postgresql/data -e
POSTGRES_PASSWORD=mysecretpassword tobi312/rpi-postgresql-postgis:9.6-2.3
Add the following crontab entry:
@reboot /home/pirate/start_pg.sh
This will start the postgres instance when the pi is rebooted.