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

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?

1 Like

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

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.