Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Postgis in docker container

I created a database with docker using the postgres image as usual

docker run -d \       
--name some-postgres \
-e POSTGRES_PASSWORD=mypassword \
-v ${HOME}/postgres-data/:/var/lib/postgresql/data \
-p 5432:5432 \
postgres

now I decided to add a new column in one of the tables to store coordinates using postgis, however when I do

CREATE EXTENSION postgis;

or something similar I get this error message:

ERROR:  could not open extension control file "/usr/share/postgresql/12/extension/postgis.control": No such file or directory

is there an additional step one has to take before running the docker container in order to install postgis?

thanks a lot

like image 883
DatGuy Avatar asked Sep 01 '20 18:09

DatGuy


1 Answers

The postgis extension does not come with vanilla postgres, which does ship with a whole bunch of more general purpose extensions, though nothing notable for geospatial. Take a look at this instead: https://registry.hub.docker.com/r/postgis/postgis/

like image 78
w08r Avatar answered Sep 19 '22 09:09

w08r