Cannot connect to MSSQL service container from self-hosted agents
Running a pipeline on a self-hosted agent with custom ubuntu sql image that was built based on
mcr.microsoft.com/mssql/server:2022-latest
anyways, running the above image on the ms-hosted ubuntu agent is working fine but when we try to run it on our self-hosted machine it's throwing the error below.
Microsoft.Data.SqlClient.SqlException : 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: 40 - Could not open a connection to SQL Server)`
our pipeline yaml looks like below, it seems like the mssql agent service is not starting? or shutting down?
pool:
name: selfhostedpool
container:
image: test.azurecr.io/mssql:2202image
endpoint: ACR-serviceconnection
env:
ACCEPT_EULA: Y
MSSQL_SA_PASSWORD: SomePassword
ports:
- 1433:1433