Reputation: 1701
I am new to docker. Here is what I am trying to do. There is web service in docker container and I want it to access existing MSSQL server.
here is the connection string
version: '3'
services:
pricing.api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ConnectionString=data source=127.0.0.1,1433;Initial Catalog=db;Integrated Security=True;
ports:
- "11102:80"
I get this error
: 'A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 35 - An internal exception was caught)'
what is wrong here? btw, I can connect to 127.0.0.1,1433 locally.
Upvotes: 2
Views: 988
Reputation: 43738
The address 127.0.0.1 inside the container refers to the container itself. Use another IP address of the host to connect to it.
Upvotes: 3