# Docker Container - Cannot Connect to SQL Server hosted on - another Container

**URL:** <https://forums.docker.com/t/docker-container-cannot-connect-to-sql-server-hosted-on-another-container/89377>\
**Category:** General\
**Created:** [February 20, 2020, 9:23pm UTC](https://forums.docker.com/t/docker-container-cannot-connect-to-sql-server-hosted-on-another-container/89377 "2020-02-20T21:23:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iwcoetzer](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/iwcoetzer/32/26550_2.png) [@iwcoetzer](https://forums.docker.com/u/iwcoetzer)\
**Post date:** [February 20, 2020, 9:23pm UTC](https://forums.docker.com/t/docker-container-cannot-connect-to-sql-server-hosted-on-another-container/89377/1 "2020-02-20T21:23:46Z")

</div>

I have two docker containers.  
One contains a sql server instance with a database that I can access from my HOST machine.

I have another container that can ping the first container.  
But I cannot seem to access the sql server instance on the first container?

I have ensure that both containers are on the same bridged network - so they can ping one another. but how do I connect?

on the host I have to connect using localhost,1433 but how do i do this on the second container?

---

<div class="post-metadata">

**Author:** ![ramasamyfordocker](https://avatars.discourse-cdn.com/v4/letter/r/77aa72/32.png) [@ramasamyfordocker](https://forums.docker.com/u/ramasamyfordocker)\
**Post date:** [February 26, 2020, 4:44am UTC](https://forums.docker.com/t/docker-container-cannot-connect-to-sql-server-hosted-on-another-container/89377/2 "2020-02-26T04:44:37Z")

</div>

Hi, I think you can use the container name of sql container to call from dirt container. Hope this works for you

---

<div class="post-metadata">

**Author:** ![iwcoetzer](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/iwcoetzer/32/26550_2.png) [@iwcoetzer](https://forums.docker.com/u/iwcoetzer)\
**Post date:** [February 26, 2020, 8:21am UTC](https://forums.docker.com/t/docker-container-cannot-connect-to-sql-server-hosted-on-another-container/89377/3 "2020-02-26T08:21:50Z")

</div>

I have since managed to connect to the SQL Server instance - container to container.

Using this driver  
“ODBC Driver 17 for SQL Server”  
And the IP address that I found using docker network inspect to find out what the IP address is of the container on which SQL Server is hosted. Also, I have to input the correct port number that I am exposing.
