databasepostgresqlapache-superset

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)



Solution

  • 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