I have two containers:
- .Net Core web API
- MS SQL Server.
I'm using entity framework core for database operations, and I'm trying to connect to the database with a connection string.
Data Source={hostname};Database=...;Initial Catalog=...;User ID=...;Password=...;
What works:
hostname=localhostfor updating locally withdotnet ef database updatehostname=172.X.X.Xfor communicating from API to the DB, where the ip address it the one docker assigns to the database
The problem is that I want to set the hostname to the name of the container. However, it doesn't work despite seeing a lot of examples online such as this article: https://blog.sixeyed.com/windows-weekly-dockerfile-17-connecting-containers/
Currently using Linux Docker on my windows machine. The containers are within the same "bridge" network.