Docker Community Forums

Share and learn in the Docker community.

Connect using sql server linux container IP address

I have recently started working with Docker. I am using Linux container on my Windows 10 host machine and trying to connect to the container database using its IP address from my local SQL server application.
Container is being successfully created and Its IP address is also being generated. While I am using that container IP and password (generated at the time of container run command), I am unable to log in.

-create container for sql server.

Docker run --name sql22 -d -p 500131:1433 -e mssql_sa_password=admin123 -e ACCEPT_EULA=Y microsoft/mssql-server-linux

-show ip

docker inspect -f"{{.NetworkSettings.IPAddress}}" sql22
172.17.0.3

after successfully created container, when i signin in sql server 2017 using that IP address, showing this error.

Please help me to sign in using IP address.

Thanks

Hi

Have you found the solution for this?

Let me repeat something I use to tell everyone getting the idea you had: If you try to access a container by its ip, you are most likely doing something wrong…

From another container: services names or network aliases are ment to be used here.
From the host: use localhost or the host’s name or ip and the mapped host port
From hosts in the lan: use the host’s name or ip and the mapped host port

Though, you left hand side of the mapping must be a typo, as 500131 is out of the valid range which ends with port 65335.

Is there a firewall in the Linux that needs to be open? I don’t know how to tell you how to open the firewall. When you created your SQL Server you gave it a port address of 1433. I suspect you have to open that port on the Linux firewall. Unfortunately I don’t know how to open the docker Linux box but the port to open is TCP 1433. There are probably others that are already open and the command you run should be one that doesn’t necessarily close any other ports that may be required.