Docker Community Forums

Share and learn in the Docker community.

Help connecting windows docker webapi to windows sql container on different vm hosts same network


(Rallison) #1

Version: 18.03.1-ce
API version: 1.37

I have a test web api running on hostA and a sql container running on hostB. Both hosts on the same network.

The sql container is running with the --name option of netsql. I need to query the netsql database on hostb from the web api running on hostA.

When I co locate both containers on the same host the following connectionstring works fine.
ConnectionString = “Data Source=netsql;Initial Catalog=Network;Uid=sa;Pwd=P@ssw0rd!;Integrated Security=False”;

But when I stop the local container and start the same container on hostB I can’t connect.

Any suggestions would be appreciated.