Connect from a docker container to SQL Server LocalDB

  docker, docker-networking, localdb, sql-server

How can I connect from a Linux container to (localdb)msSqlLocalDB running on the host?

I have several containers that include databases and I have no problem connecting to them from my local machine. I also have containers that connect to resources on my box using host.docker.internal. In this case, I need to connect from the container, to SQL Server localdb running on my machine.

I’m part of a large team and the developers are using localdb. I am introducing docker into our environment, with my new application, and it will need to connect to their existing localdb.

I know how to use host.docker.internal to reference the host, but I don’t know how to connect to localDB. I think LocalDB uses named pipes instead of a network name and I am having trouble with the connect string.

Source: Docker Questions