Getting Postgres DB connection error when running JSM on docker locally

I’m running Postgres and JSM through Docker (e.g. desktop app), and when connecting to Postgres in JSM database connection window I keep getting the error below.

Error connecting to database

Connection to localhost:5433 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

Connection refused

There is no issue with database credentials and availability in my local environment, as I’m able to connect through terminal. I have also added “listen_addresses = ‘*’” in postgresql.conf, but no success, is there anything I can check or do?

FYI. I’m running postgres not on default port, just in case the port was a problem, but still the same issue.


Thanks in advance!

For anyone who will encounter this issue, here is the solution:
Just replace “localhost” with “host.docker.internal” when connecting DB

Hey Robert,

You can also point to your postgres instance by its container name. So in the host, you just write “some-postgres” as it seems to be the name of the container.

Another important thing is that to be reachable your containers needs to be in the same virtual network.

If you are familiar with docker compose it is better to enable them as services in one docker compose file rather than two separate docker files.

Let me know if you need further indications.

Kind regards,