Docker Community Forums

Share and learn in the Docker community.

How to connect to a external SQL Server from inside container - asp.net 3.5, connection string


(Douglasdc) #1

Hello All,

I’m moving a legacy application using asp.net 3.5 to docker, I was able to make the application run on container. This application connect to a SQL Server hosted on another server (not container). When I try to access some parts of my application that try to connect to SQL Server I’m getting this error (The network path was not found - I’m using a static IP on my connection string). I understand the container cannot find my SQL host on network, I open port 1433 on container, but is not working, tried to set --net=host not working.

How can I fix this, so container can access my external SQL server database that is hosted on another server on my network?

Thank you

Regards,
Douglas


(Saurabhgayali) #2

Probably you have to expose port using bash while starting the docker itself.
1433 on PC does not correspond to 1433 on docker.
exposing simply associated this connection

docker run -i --expose=22 b5593e60c33b bash

Source: