0

Web API that I'm trying to connect to an sqlserver database in the google cloud. Both the API and the dockerized instance of cloud sql proxy are in the same docker-compose file (and therefore on the same default bridge network). The docker-compose file

The docker-compose override is as follows:The docker-compose override file

Currently the UID and password for the sql server connection are being passed into the connection string directly from the appsettings.json.

If I have the containers running, I can connect to my database via the proxy from within a local instance of the API run through visual studio (IIS Express) but for some reason if I make a request to the API once it's been containerized, I get a "

server was not found or accessible

Any ideas on what could be causing the issue?

Sachith Muhandiram
  • 2,819
  • 10
  • 45
  • 94
Mivao
  • 1
  • Can you please post your `docker-compose` file in the question. Not the image – Sachith Muhandiram Mar 24 '21 at 03:35
  • Thanks for your interest. Turns out I should've read https://stackoverflow.com/questions/45836831/is-there-a-way-to-access-google-cloud-sql-via-proxy-inside-docker-container more carefully Don't use localhost inside your connection strings I guess :/ – Mivao Mar 24 '21 at 03:51
  • @Mivao Can you post the solution you found as an answer to this post? This could be helpful for other people facing the same problem. – Nahuel Apr 13 '21 at 09:48

0 Answers0