Access localhost SQL Server Express from within docker container running in docker-desktop

30 Views Asked by At

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?

0

There are 0 best solutions below