I have a restful api app and it depends on a sql db (sql server 2012-express). Restful Api app picks all colours related data from sql-db tables.The restful api made at dotnetcore 2.2 and define sql-db connection at 'appsettings.json' as below ..
"ConnectionStrings": "data source= xxx,1433;Initial Catalog=ColoursDB;Integrated Security=True;ConnectRetryCount=0"*
I am using 'Microsoft.EntityFrameworkCore' ORM of version 1.0.1 for sql db data retrieving..
Locally , running api , it fetches colour data from sql-DB..but when i did linux container as below command at windows -powershell and passing 'ConnectionStrings' as environment variable ..Api container gave an exception
For Build api-&gt; $ docker build -t colourapiandsql:v1 -f Dockerfile .
For Run api -&gt; $ docker run -d -p 8080:80 --name api01 -e ConnectionStrings="data source=xxx,1433;Initial Catalog=ColoursDB;Integrated Security=True;" colourapiandsql:v1
Api container is created but it gave an exception as below
"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 35 - An internal exception was caught)".
Can you pls help me or guide me on how i can pass local DB 'ConnectionStrings' as environment variable at docker run command?