简体   繁体   中英

Connecting to sql server on windows machine from a .net app on docker container on linux

We have SQL server 2014 running on the Windows machine. We have a microservice developed using .net. This microservice deployed using a docker container on the Linux machine. To connect from the microservice to the SQL server, we used integrated security = true in the connection string of the microservice.But this is not working. Can someone help us resolve this issue? We don't want to use the user name and password in the connection string.

What is connection string here ? If it is a string parameter you are trying to pass inside in your application as username and password then below solution will work:

Run you container with env variables ( env variables will be your credentials)

ex:

docker run -d --name ${processName} --env-file /opt/properties.file -p ${exposePort}:${servicePort} ${dockerRegistry}/${projectName}/${serviceName}:${imageTagName}

properties.file here will be your connection string stored on your machine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM