Can't connect remotely to PostGIS docker

1

I've created a PostGIS docker container with the following code:

docker run --name=h4d -d -e POSTGRES_USER=h4d_user -e POSTGRES_PASS=password -e POSTGRES_DBNAME=gis -e ALLOW_IP_RANGE=0.0.0.0/0 -p 5432:5432 -v h4d_data:/var/lib/postgresql --restart=always kartoza/postgis:latest

I can connect to the docker from my localhost, but I can't from another terminal. The error message says "could not connect to server: Connextion timed out (0x0000274C/10060) Is the server running on host "" and accepting TCP/IP connections on port 5432?

I'm not sure if maybe I must edit some firewall settings or something else. I'm working on Windows 10

postgresql
docker
postgis

1 Answer

1

Maybe this will help ..

Go to the postgresql.conf and change the parameter of listen_addresses to the ip address you wish or just place * for all ips, e.g:

listen_addresses = '*'

In the pg_hba.conf file you also have to add which ips and users may access a certain database, e.g.

host my_db my_user 128.176.1.1 md5

In an Ubuntu machine these files are normally found at: /etc/postgresql/10/main

answered on Stack Overflow Jun 15, 2020 by Jim Jones

User contributions licensed under CC BY-SA 3.0