My DB connection string uses this: Data Source=.\\sqlexpress; to point to the DB,
this works when running the project diectly but not when running it inside docker locally using docker-desktop.
I tried using Data Source=localhost,1433; and mapping the port 1433:1433 in compose.yaml, but it didn't help, also I was looking in TCPView, didn't see SQL listening to 1433 or any other port.
Has anyone ever managed to connect to the localhost sqlexpress from inside docker container running also on localost?
localhost,127.0.0.1and::1all reference the container itself. If you need to access services exposed or installed on the host, have you tried the specialhost.docker.internalname?localhost). Does one of the techniques there help you?A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - Success)when usingData Source=host.docker.internal,1433in my connection string