Jump to content

Recommended Posts

Posted

I try to connect to postgres database on docker from my local but I recive this message:

Failed
DBMS: PostgreSQL (no ver.)  Case sensitivity: plain=mixed, delimited=exact
Connection to vps95.heliohost.us:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. 

I use this string connection: jdbc:postgresql://vps95.heliohost.us:5432/

The info of my account is:

IPv4: 65.19.166.234
IPv6: 2001:470:1:1ee::95
SSH Port: 22
Memory: 1 GB
CPUs: 2
Storage: 50 GB
OS: Ubuntu22
Domain: vps95.heliohost.us

I don't know if this is the right way to make a connection.

Posted

I assume you're connecting from your PC and not from something else that's running on the VPS?

If so, do you have a firewall configured on the VPS and is port 5432 open inbound through it so the connection can reach the pg server?

  • Like 1
Posted (edited)

I created the account yesterday, only installed Docker and create the container but I don't know if the VPS have by default a firewall, I do not configured any one. Neither  I know if the port 5432 is open, I have been assume that yes.

Note: yes, I try to connect from my local PC using DBeaver

Edited by jesfaj7
Posted

The firewalls on VPS are off by default when it is built. So it is only active if you enable it. Since you're running the database inside Docker instead of directly on the VPS you have to allow the remote connection twice. Once it get outside the Docker container, and then again to get outside the VPS. If you install PostgreSQL directly it's a little easier and you only have to allow it once instead of having two layers. This link should help you https://stackoverflow.com/a/37704532 If after reading this stackoverflow you still have questions, let us know.

  • Like 1
Posted

Thanks you Krydos, the problem was that I not had expose the port 5432 for the Docker container, I saw the error reading the Stackoverflow link that you shared

  • Krydos changed the title to [Solved] Connection to Postgres in Docker container
  • Krydos locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...