Docker communication inside docker compose and with database which is outside docker

You can choose any of these two options:

  1. Make your postgresql listen to all your network interfaces (or the docker bridge for more secure but complex setup), to achieve that you need to make sure your config looks like this:
# grep listen /var/lib/pgsql/data/postgresql.conf
listen_addresses = '*'
  1. Use host network mode in your docker compose, which runs docker in your host network name space instead of creating a new network:
network_mode: "host"

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top