Let’s look more closely at how to access Docker from SSMS. With the help of our Docker support services, we at Skynats can provide a thorough overview of the entire procedure.
How to access Docker from SSMS?
SSMS uses the default SQL client port 1433. We do not need to open any additional ports or launch any new services with the SSM because the SQL Server images provided by Microsoft and this book already have everything configured. We can log in using SQL Server authentication with the SA credentials we use to manage the container.
This program starts a container for SQL Server 2019 Express Edition by publishing port 1433 to the host and employing the SA credentials:
docker container run -d -p 1433:1433 ` -e sa_password=DockerOnW!nd0ws ` --name sql ` dockeronwindows/ch03-sql-server:2e
Due to this publishing of the basic SQL Server port 1433, there are 3 methods for connecting to the SQL Server inside the container:
Remotely accessing the docker container using SSMS
- To connect with SSMS, enter the public IP address, a comma separator, and the port (xxx.xx.xx.xxx,port). We also require the SA credentials to accomplish this.
- Input for the server changes to Server IP, Port#.
- To connect to the Docker container on the local PC using SSMS, use localhost IP. In this case, entering the Server Name will show results 127.0.0.1,port#.
We can quickly connect to the SQL Server from the SSMS with the help of the SSMS. Try the command line provided below to quickly configure this option.
docker run --name mssqltrek-con1 -d -p 1433:1433 -e sa_password=My$eCurePwd123# -e ACCEPT_EULA=Y microsoft/mssql-server-windows-developer.
That after, we can use the methods below to obtain the correct IP and complete the access docker from ssms:
docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" mssqltrek-con1
Conclusion
To summarise, we learned how to connect to Docker from SSMS with the help of our tech support team. We demonstrated how to use SQL Server Management Studio to establish a remote connection to the Docker container.