Docker container with external Pg database on different subnet

Hello,

I would like to know if it’s possible to have a webapp container running on Docker which interacts with a PostgreSQL database which is on its own server on a different subnet? Both, the docker cluster and the database server, are in the same data center but just on different networks with are routed and just 1 hop away.

regards,
j.