D
Dokploy11mo ago
ningshen

Why can't the PostgreSQL database be accessed from the external network? Where is the problem?

I want to verify if the PostgreSQL I created can be accessed through an external network. I used the telnet host port command in PowerShell to test if the host can be connected, then used the Ctrl+] command and entered status. The screen shows that it is connected, but after about a minute, it shows that the connection is lost. When I use pgAdmin to connect to my database, it keeps failing and shows "connection timeout expired". However, if I use psql -U myusername -d dbname inside the container, I can enter the database normally and use various commands. In other words, it works normally inside the container but not from the outside. Where could the problem be? I am sure I have opened external port 5432.
No description
No description
6 Replies
Siumauricio
Siumauricio11mo ago
@ningshen what value are you using in your hostname? your domain or your ip?
ningshen
ningshenOP11mo ago
i used my domain
Siumauricio
Siumauricio11mo ago
Use your ip instead
ningshen
ningshenOP11mo ago
After reading your reply, I tried to log in with the host IP again, and now I can log in successfully thank you , brother😍 If you are using an internal host, should you replace it with 127.0.0.1 as well ?
Siumauricio
Siumauricio11mo ago
No, in that case you should use the internal host
ningshen
ningshenOP11mo ago
well,thanks 😀

Did you find this page helpful?