Search code examples
linuxpostgresqldockernetwork-programmingfedora

Can't connect to my docker host postgresql database from a container


If I do ifconfig, docker0 ip is 172.17.0.1 and when I run my containerized app and then docker network inspect bridge myapp ip is 172.17.0.2, they are on the same network I suppose.

But inside myapp I am trying to connect to my docker host's postgresql database, I provide 172.17.0.1:5432 to my ORM but it throws an error connect ECONNREFUSED 172.17.0.1:5432.

What is the problem ?


Solution

  • I forgot to add listen_addresses="*" in postgresql.conf ...