I am running SQL Server Express inside of a Windows container on Windows 10. It runs fine, and I can connect to the instance of SQL Server if I either
- Provide the container’s IP address (I get this from 'docker inspect ')
- Use the first 12 characters of the container’s ID (for instance, "XYZ123ABC456\SQLSERVER)
What I would like to do is have a static DB connection string for all of the other containers to use in order to connect to the database. Of course, every time I start the SQL Server container, the container has a different container ID and IP address.
An important thing to note is that all of my containers are running on my laptop. I have heard that there is a problem with loopback in that you cannot use ‘localhost’ in the IP address.
I am sure there is an easy solution to this. Would you please give me some hints?
Edit: I am also using docker-compose to create the various services, including the SQL Server container.