docker pull postgis/postgis

docker run --name postgis --privileged=true --restart=always \
-e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=simple -p 54321:5432 \
-v /dp/docker/file/postgis/data:/var/lib/postgis/data \
-v /dp/docker/file/postgis_postgresql/data:/var/lib/postgresql/data -d postgis/postgis

注意已经安装过pg的端口不要冲突,文件也不要覆盖

如果提示PostGIS Error: type “geography” does not exist
需要执行一下CREATE EXTENSION Postgis;