I’m facing a problem, I’m creating a docket compose for sqlserver and ASP.NET applications, but when the application is launched, it does not connect to the server
docker-compose:
version: '3.4'
services:
web-site1:
image: ${DOCKER_REGISTRY-}website1
build:
context: .
dockerfile: Web-site1/Dockerfile
environment:
CONNECTION_STRING: "Server=sqlserver;Database=Web-site2;User Id=sa;Password=191202G@v"
ports:
- "8080:8080"
- "8081:8081"
depends_on:
- sqlserver
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
ports:
- "1433:1433"
environment:
ACCEPT_EULA: "Y"
SA_PASSWORD: "191202G@v"
volumes:
- sqlserverdata:/var/opt/mssql/data
- sqlserverlog:/var/opt/mssql/log
volumes:
sqlserverdata:
driver: local
driver_opts:
o: bind
type: none
device: "F:/Progect/Web-site1/Web-site1/bin/Release/net8.0/publish/sqlserverdata"
sqlserverlog:
driver: local
driver_opts:
o: bind
type: none
device: "F:/Progect/Web-site1/Web-site1/bin/Release/net8.0/publish/sqlserverlog"
**Connect link: **
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
},
"ConnectionStrings": {
"DefaultConnection": "Server=sqlserver;Database=Web-site2;User Id=sa;Password=191202G@v"
}
},
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://0.0.0.0:5156"
}
}
}
}
I think the problem is in the connection method
New contributor
Егор Гаврилов is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1