connection string for sqlserver in Docker container
Rather than use IP addresses, which would be problematic in a team environment, you can also use host.docker.internal which will resolve to your host IP.
Data Source=host.docker.internal,1433;Initial Catalog=MyDB;User ID=MyUser;Password=MyPassword
sudo docker pull microsoft/mssql-server-linux:2017-latest
docker run \
-e 'ACCEPT_EULA=Y' \
-e 'MSSQL_SA_PASSWORD=YourSTRONG!Passw0rd' \
-p 1401:1433 \
-n sql1 \
-d microsoft/mssql-server-linux:2017-latest
then,
private static string _connStr = @"
Server=127.0.0.1,1401;
Database=Master;
User Id=SA;
Password=YourSTRONG!Passw0rd";
Most likely your server name is localhost and port 1401 (which is the default for Docker container setup). Therefore, you'll need to use the following connection string:
"Default": "Server=localhost,1401; Database=ERPDb; User=sa; Password =******;"