Recommended configuration method when developing dockerized apps?

I started using Dotnet Core 3 preview to develop a Service Worker app and initially I was doing the classic F5 Debug, cosole host launches, app runs, etc. I have a PostgreSQL instance running via Docker and I’ve configured the connection string in the appsettings.json file, pointing to localhost as the server address. All this worked fine.

Then I switched the environment to debug in Docker, started the debug session and things kinda worked, except for the database, which it could no longer find under localhost for obvious reasons. I extracted the IP address of the database container, updated the appsettings.json to use that address instead of localhost and everything worked fine again. (Except that I couldn’t reach the database via the IP address from my host machine, I’mo sure there’s a reason for it)

What I’m trying to figure out is how can I keep one set of configuration that works both in docker and regular mode?

submitted by /u/romeozor
[link] [comments]

Leave a Reply