I've been searching this a couple of days and I can't get a solution.
I'm using .NET Core 1.1 and VS2017 with Docker Tools. When I run the app with self-hosted option or IIS everything is OK. I'm using Ngpsql as data provider for PostgreSQL and the thing works great. The problem appears when i run the app as a container with Docker (the image build nice, the container runs in Windows and Linux) because my Postgres Host is localhost and the Core app can't see my local PostgreSQL instance (because for the container localhost is the container itself and not my host machine). I know there are LOTS of tutorials and walkthroughs to do this with .NET Core and PSQL through Docker Compose (a container for each one), I know that. I assume they work great BUT the requirements for this job is that de containerized Core app read/writes data from a locally installed PostgreSQL server.
In production, the Core Container and the LOCALLY installed PostgreSQL will be in the same machine with the same address. I know this must be a simple parameter thing or something like that, but I don't want to lose portability of the Docker Container by using in the connection string my (development) machine ip because the deploy/run scenario in the production server will be automatized via Docker Cloud and stuff.
Maybe passing a parameter? Properly exposing docker container port? What? WHAAAT?!