0

How do you connect to a SQL Server database on a host (or even in the cloud, as in off the local network) from a windows server-based container? I've tried using

docker run --net="nat" ...

and

docker run --net="host" ... 

to no avail. Using -p does not seem relevant as I want to container to talk to the SQL Server database not running in a container.
I'm not sure how a custom network bridge can work here but I'm open to trying.

Irwin
  • 12,551
  • 11
  • 67
  • 97
  • The default network should allow connecting to a remote host. Have you tested connectivity from the running container, e.g. `docker exec -it your-container cmd /C"ping "`? – Dan Guzman Feb 03 '19 at 19:56
  • Possible duplicate of [Can't connect to SQL Server express from .net core app running on docker](https://stackoverflow.com/questions/46409215/cant-connect-to-sql-server-express-from-net-core-app-running-on-docker) – Irwin Feb 04 '19 at 01:32
  • `networks: default: external: name: nat` in docker compose file helped me connect to sql server from conatiners – prisar Feb 06 '19 at 10:06

0 Answers0