Skip to content

Instantly share code, notes, and snippets.

@matt-baker
Last active July 19, 2016 23:06
Show Gist options
  • Save matt-baker/206ffbd5e17c88482b99930ac16ccf35 to your computer and use it in GitHub Desktop.
Save matt-baker/206ffbd5e17c88482b99930ac16ccf35 to your computer and use it in GitHub Desktop.
Docker PostGIS workaround
# Start the container and mount a local volume so you can access the shapefiles
# In this instance I am mounting /gisdata to /gisdata in the container
docker run --name "postgis" -v /gisdata:/gisdata -p 25432:5432 -d -t kartoza/postgis
# Attach to running container
docker exec -i -t postgis /bin/bash
# Install postgis using postgis rather than postgresql-9.5-postgis-2.2
apt-get install postgis
# Confirm that the utilities were installed
ls -la /usr/bin/ | grep shp
# Install vim, edit pg_hba.conf, and reload postgres
apt-get install vim-nox
vi /etc/postgresql/9.5/main/pg_hba.conf
# local all all peer
local all all md5
service postgresql reload # DO NOT use restart
# Export data to /gisdata
pgsql2shp -u docker -P docker -f /gisdata/test.shp database table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment