📢 Important: This is now legacy, but the code lives on: Please go to https://github.com/ProSuite/geodatabase-containers
This repository provides tools to create an Esri Enterprise Geodatabase in Docker based on a PostgreSQL/PostGIS image. The setup supports SQL access using PostGIS spatial functions and Esri's st_geometry spatial type.
- Build a Docker image with PostgreSQL/PostGIS and Esri's
st_geometrylibrary. - Create and configure a Esri Enterprise geodatabase inside a container.
- Docker Desktop
- PostgreSQL with PostGIS (PostGIS is included in the Docker image).
- ArcGIS installation files for the
st_geometrylibrary (st_geometry.sofor Linux orst_geometry.dllfor Windows).
Build-Image.ps1: Automates the Docker image build process.Run-Container.ps1: Starts the PostgreSQL container with the configured settings.Create-SpatialType.ps1: Configures spatial extensions likepostgisandst_geometry.Create-ArcGIS-Enterprise-Geodatabase.py: Creates an Esri Enterprise Geodatabase using ArcGIS Python tools.
- Dockerfile: Specifies the image setup with
st_geometryand initialization scripts. st_geometry.so: The Esri spatial library (to be added manually).- Go to https://my.esri.com > Downloads > ArcGIS Pro
- Scroll down to ArcGIS Pro ST_Geometry Libraries (Postgres)
- Click Download to get a Zip archive that contains st_shapelib for Windows, Linux, and others
- My Esri often changes, so be prepared to spend some time searching
- You can specifie the path where the st_geometry file lies in the dockerfile
- You will need to specifie the location to your keycode file.
Use the Build-Image.ps1 script to create a Docker image:
.\Build-Image.ps1POSTGRES_PASSWORD: Password for the PostgreSQL database superuser.POSTGRES_DB: Default database name.POSTGRES_USER: Default database user (superuser).
Ensure the st_geometry.so file is present in the same directory as the Dockerfile.
Use the Run-Container.ps1 to start up the docker containere:
.\Run-Container.ps1containerName: The name of the Docker container.hostDataDir: Path on your host machine to store PostgreSQL data persistently.dbName: Name of the database to be created.dbUser: The PostgreSQL superuser name.dbPassword: Password for the PostgreSQL superuser.imageName:
Use the Create-SpatialType.ps1 to configures spatial extensions
.\Create-SpatialType.ps1containerName: The name of the Docker container.dbName: Name of the database to be created.dbUser: The PostgreSQL superuser name.dbPassword: Password for the PostgreSQL superuser.
Use Create-ArcGIS-Enterprise-Geodatabase.py to create an esri enterprise geodatabase
The path to your keyfile (auth_file) need to be updated.
python .\Create-ArcGIS-Enterprise-Geodatabase.pyAfter building and running the Docker container, you need to copy the st_geometry library into the container. Follow these steps:
-
Locate the
st_geometrylibrary
Ensure you have the correct version ofst_geometry.sofor your PostgreSQL version. You can obtain this file from your ArcGIS installation under the appropriate folder for PostgreSQL. -
Copy the library into the container
Use thedocker cpcommand to copy the library into the correct directory within the container:docker cp "C:\path\to\st_geometry.so" <container_name>:/usr/lib/postgresql/15/lib/st_geometry.so
-
Set proper permissions for the library
Once copied, log into the container and set the correct permissions:docker exec -it <container_name> bash chmod 755 /usr/lib/postgresql/15/lib/st_geometry.so
-
Update
postgresql.conf
Ensure that theshared_preload_librariesparameter in your PostgreSQL configuration file (postgresql.conf) includes thest_geometrylibrary:nano /etc/postgresql/15/main/postgresql.conf
Add or update:
shared_preload_libraries = 'st_geometry' -
Restart the PostgreSQL service
To apply the changes, restart the PostgreSQL service inside the container:service postgresql restart
-
Verify the
st_geometrylibrary is loaded
Log into the PostgreSQL instance and load the library to confirm:psql -U postgres -d EGDB LOAD 'st_geometry';