Access a service on host from a container

I have a machine with a postgres database, and I’m adding a rails server container, I want to make the rails server to access the postgres database, the only way to achieve it was using the network host.
it turns out that if I change the rails container network, the load balancer stops working.
I’m not a rancher/docker network expert.
What would you guys do ?
Thanks in advance.