Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

connect superset to postgresql in a docker container - The port is closed

My operating system is Linux.
I am going to connect Superset to PostgreSQL.
PostgreSQL port is open and its value is 5432.
PostgreSQL is also running and not closed.
Unfortunately, after a day of research on the Internet, I could not solve the problem and it gives the following error:

The port is closed.

enter image description here

Database port:
enter image description here


command: lsof -i TCP:5432
python3 13127 user   13u  IPv4 279806      0t0  TCP localhost:40166->localhost:postgresql (ESTABLISHED)
python3 13127 user   14u  IPv4 274261      0t0  TCP localhost:38814->localhost:postgresql (ESTABLISHED)

Please help me, I am a beginner, but I searched a lot and did not get any results.

Solution

Use host.docker.internal instead of 127.0.0.1 or localhost .(thanks pdxrlk)


like image 967
user8519380 Avatar asked Dec 05 '25 17:12

user8519380


1 Answers

Since you're running Superset in a docker container, you can't use 127.0.0.1 nor localhost, since they resolve to the container, not the host. For the host, use host.docker.internal

like image 64
pdxrlk Avatar answered Dec 08 '25 12:12

pdxrlk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!