You may want to check how to assign environment variables with semicolon in bash.
Remember, in *nix environment, semicolon carries special function as command separator.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi All,
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 ..
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "",
"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-> $ docker build -t colourapiandsql:v1 -f Dockerfile .
For Run api -> $ 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?
Many Thanks,
You may want to check how to assign environment variables with semicolon in bash.
Remember, in *nix environment, semicolon carries special function as command separator.
Changed and tried again .I looked into api container logs , error is coming as above.
I also found below reference thread for 'mcr.microsoft.com/mssql/server:2017-CU11-ubuntu' or 'mcr.microsoft.com/mssql/server:2017-latest' and it is saying that for Windows 10 Pro 1809+ as host , it gives a fatal error and possible not able to connect with another container.. or mounting purpose
https://github.com/microsoft/mssql-docker/issues/441
i am using host as win 10- Pro , Version 10.0.18362 -Build 18362 and docker-desktop,version:2.3.0.4(46911)-Engine:19.03.12 that why.. containers r creating successfully at OS/Arch: linux/amd64 environment but not able to connect with DB container.
Thank you very much to everybody who helped me a lots and understanding the real root cause.
Thanks,