0

Got a small question here. I suppose I've done something wrong at a moment but i can't find where and it's been +2 hours I'm turning around.

So Basically, I've created a docker-compose with Postgis (Postgres). I wanted to connect on it through Tableplus. However, I can't ...

2 kind of error keep appearing :

  1. When I try to connect basically on 127.0.0.1, it's keep telling me connection refused
could not connect to server: Connection refused
    Is the server running on host "127.0.0.1" and accepting
    TCP/IP connections on port 5432?

example

  1. When I try to use the docker IPAddress - 172.23.0.2 (docker inspect the image's ID to get the IP address of the image)
could not connect to server: Operation timed out
    Is the server running on host "172.23.0.2" and accepting
    TCP/IP connections on port 5432?

Here is my docker-compose.yml

version: '3.5'


services:
  db:
    image: kartoza/postgis:12.1
    environment:
      - POSTGRES_USER=user1
      - POSTGRES_PASSWORD=password1
      - POSTGRES_DB=database_db
    volumes:
      - data_db_volume:/var/lib/postgresql/12
    ports: 
      - "5432:5432"
    
volumes: 
  data_db_volume:

At first, when I tried to connect, it was telling me: role user1 doesn't exist.

So to stop this I ran: brew services stop postgresql on my machine

I think a psql was running locally on the same port because with lsof -n -i:5432 | grep LISTEN i keep having information (it stop since I ran stop Postgresql)

L.S
  • 173
  • 2
  • 13
  • Have you tried with localhost or 0.0.0.0 instead of 127.0.0.1 ? – Panagiotis Bougioukos Dec 28 '20 at 13:09
  • Hi @PanagiotisBougioukos, yes both lead to the same result: connection refused :( – L.S Dec 28 '20 at 13:43
  • Then the database works well but it just refuses the connection (probably because of a firewall). Check here https://stackoverflow.com/a/41161674/7237884 – Panagiotis Bougioukos Dec 28 '20 at 14:04
  • Hi @PanagiotisBougioukos , I checked and my configuration was already like the answer you send me, i also checked pg_hba.conf and it seems correct to accept external connection ... I lost .... – L.S Dec 30 '20 at 11:20

1 Answers1

1

Alright so after few days of research and trying on another computer, it seems it was coming from 2 points: the new docker software with a graphic interface that I didn't use before, once this running correctly and a prune done from this place everything started to work fine so I think something was causing error due to an outdated piece of software.

Thank's everyone

L.S
  • 173
  • 2
  • 13