Is it possible to connect geoserver to local postgis database in app development?

634 views
Skip to first unread message

chardi...@gmail.com

unread,
Jul 18, 2019, 2:53:35 PM7/18/19
to Tethys Platform
I am developing an app, and a PostGIS database  If I go to 127.0.0.1:8181/geoserver/web/, log in, and "Add new store" with parameters host = localhost and port = 5435, and try to connect, I get "Error creating data store, check the parameters.  Error message: Unable to obtain connection: Cannot Create PoolableConnectionFactory (Connection to 127.0.0.1:5435 refused...

Using 127.0.0.1 and/or 5432 instead of "localhost" and/or "5435" gives same error.  But I am able to connect to essentially the same PostGIS database where it is not local.

Someone more advanced than I am said that it seems that the geoserver docker container is having a hard time resolving to the local host. 

Is it possible to connect Geoserver to a local PostGIS database?

Michael S

unread,
Jul 19, 2019, 12:20:48 PM7/19/19
to Tethys Platform
It is definitely possible. I'm attaching a screenshot of a working postgis store. Hopefully that helps.
tempsnip.png

swainn

unread,
Jul 19, 2019, 3:47:41 PM7/19/19
to tethysp...@googlegroups.com
Think of the docker containers as individual servers. Host localhost inside the PostGIS container is different than localhost inside the GeoServer container, just like if you had PostGIS and GeoServer running on separate servers. You need to specify the host of the PostGIS container OR at the Docker network the two containers are sharing. I often specify the default Docker hostname 172.17.0.1, when both containers are running on the same machine.

Sarva Pulla

unread,
Jul 19, 2019, 5:56:15 PM7/19/19
to Tethys Platform
+ 1. I was able to connect to the postgis container using 172.17.0.1 as the host and 5435 as the port. 

chardi...@gmail.com

unread,
Jul 20, 2019, 3:58:31 PM7/20/19
to Tethys Platform
Thanks, you guys! Using 172.17.0.1 worked!
Reply all
Reply to author
Forward
0 new messages