I'am working on this simple docker-compose file. It starts a node.js server that connects to a postgresql database hosted by the host machine.
version: '3'
services:
node-server:
build:
context: ./docker-test
networks:
- my-network
extra_hosts:
- "db-server:172.17.0.1"
networks:
my-network:
driver: bridge
Here I'am appending a new host entry db-server which gets the value of the docker0 interface ip.
Is there a solution to dynamically set the "db-server" to my-network gateway ip?