Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
BuildMaster and Otter SQL connection issue (Docker/ Linux)
-
I created a docker-compose file in Portainer to use proget, buildmaster and otter. I already had a SQL Server Express as a Linux Docker. I created the 3 databases and 3 different access to each of one.
I then started everything. The only docker that accept to run is Proget. BuildMaster and Otter refuses to start because it detect a network issue contacting SQL Server (which is not the case with Proget).
The network and environment is the same on all 3 containers.
Here's the complete docker-compose file. After is the "docker logs buildmaster" with the connection error.
docker-compose.yml
version: '3.8' services: proget: image: proget.inedo.com/productimages/inedo/proget:latest container_name: proget restart: unless-stopped environment: - SQL_CONNECTION_STRING=Data Source=mssql; Initial Catalog=ProGet; User ID=proget; Password='MyPassWord!!'; MultipleActiveResultSets=true - TZ=America/Toronto networks: - nginx-proxy - databases volumes: - /opt/docker/data/proget-packages:/var/proget/packages buildmaster: image: proget.inedo.com/productimages/inedo/buildmaster:latest container_name: buildmaster restart: unless-stopped environment: - SQL_CONNECTION_STRING=Data Source=mssql; Initial Catalog=BuildMaster; User ID=buildmaster; Password='MyPassWord!!'; - TZ=America/Toronto networks: - nginx-proxy - databases volumes: - /opt/docker/data/buildmaster-artifacts:/var/buildmaster/artifacts otter: image: proget.inedo.com/productimages/inedo/otter:latest container_name: otter restart: unless-stopped environment: - SQL_CONNECTION_STRING=Data Source=mssql; Initial Catalog=Otter; User ID=otter; Password='MyPassWord!!'; - TZ=America/Toronto networks: - nginx-proxy - databases networks: nginx-proxy: external: true databases: external: true
docker logs buildmaster
BuildMaster version is 22.0.3.8. Current DB schema version is unknown. Unhandled exception: Microsoft.Data.SqlClient.SqlException (0x80131904): 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) ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000001, 11): Resource temporarily unavailable at System.Net.Dns.GetHostEntryOrAddressesCore(String hostName, Boolean justAddresses, AddressFamily addressFamily, ValueStopwatch stopwatch) at System.Net.Dns.GetHostAddresses(String hostNameOrAddress, AddressFamily family) at System.Net.Dns.GetHostAddresses(String hostNameOrAddress) at Microsoft.Data.SqlClient.SNI.SNICommon.GetDnsIpAddresses(String serverName) at Microsoft.Data.SqlClient.SNI.SNITCPHandle.Connect(String serverName, Int32 port, TimeSpan timeout, Boolean isInfiniteTimeout, SqlConnectionIPAddressPreference ipPreference, String cachedFQDN, SQLDNSInfo& pendingDNSInfo) at Microsoft.Data.SqlClient.SNI.SNITCPHandle..ctor(String serverName, Int32 port, Int64 timerExpire, Boolean parallel, SqlConnectionIPAddressPreference ipPreference, String cachedFQDN, SQLDNSInfo& pendingDNSInfo, Boolean tlsFirst, String hostNameInCertificate) at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides) at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides) at Microsoft.Data.SqlClient.SqlConnection.Open() at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.GetConnection() at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.ExecuteTable[TResult](String query, Func`2 adapter, SqlTransaction transaction, SqlParameter[] args) at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.GetChangeScriptVersion(SqlTransaction transaction) at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.GetState() at Inedo.DbUpdater.ConsoleHost.Update(String scriptPath, String connectionString, Boolean force) at Inedo.DbUpdater.ConsoleHost.Run(ArgList args) at Inedo.DbUpdater.ConsoleHost.RunAsync(IEnumerable`1 args) at Inedo.BuildMaster.Windows.ServiceApplication.Program.UpdateDatabaseSchemaAsync() in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E306669\Src\BuildMasterSolution\BuildMaster.Service\Program.cs:line 286 at Inedo.BuildMaster.Windows.ServiceApplication.Program.Run(WebServerMode mode, Boolean runAsService, Boolean linuxContainer, String nodeName) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E306669\Src\BuildMasterSolution\BuildMaster.Service\Program.cs:line 26 ClientConnectionId:00000000-0000-0000-0000-000000000000
-
The error is definitely that the BuildMaster and Otter containers cannot find a server with the name of
mssql
. I'm surprised that ProGet works, but Docker can be confusing. This seems to be a pretty common docker issue. How I have solved this in the past is to add an alias to the network section on your SQL Server container. For example:networks: databases: name: mssql
Because you are using the
databases
network on ProGet, BuildMaster, and Otter containers also, that will add a hostname ofmssql
to the docker network and make it accessible by name. I would also suggest adding an alias to your ProGet, BuildMaster, and Otter container configurations to prevent issues with these servers being able to communicate with each other as well.For more information, see our Docker-Compose installation guide.
Thanks,
Rich
-
I tried setting aliasses and names. I moved my MSSQL to another "stack" in Portainer. The network need to be force as "external" in order for the network to speak with other stacks (other docker-compose).
I tested each password using sqlcmd and SQL Studio. I even tried connecting with SA without success.
This is the last connection string I use on all 3 containers using the IP address of my Linux SQL Server. As all my tests, ProGet starts and don't have any issues. But BuildMaster and Otter don't.
Is it possible that a driver or packages is missing from those 2 images? I can access the SQL using telnet or ping within "buildmaster" (between recreation), but connecting seems to always fails...
SQL_CONNECTION_STRING=Server=172.23.0.15,1433; Database=BuildMaster; User ID=buildmaster; Password=MyStrongPassword;
-
Strangely enough, it seems your doc there is not up to date...
https://docs.inedo.com/docs/docker-compose-installation-guideAs per this link, I changed buildmaster's environment variable to use "BUILDMASTER_SQL_CONNECTION_STRING" and not "SQL_CONNECTION_STRING". Now buildmaster is starting without issue!
https://docs.inedo.com/docs/installation-troubleshooting-docker-installationsBut Otter won't start using BUILDMASTER_SQL_CONNECTION_STRING, SQL_CONNECTION_STRING or OTTER_SQL_CONNECTION_STRING. What could be the correct environment variable for Otter?
-
There was an error in my last message. I made a error on the connection string of Otter.
The correct environment variable to use is OTTER_SQL_CONNECTION_STRING.
So, per container, it seems that images wants those environment variable to contain the MSSQL connection string.
ProGet: SQL_CONNECTION_STRING
BuildMaster: BUILDMASTER_SQL_CONNECTION_STRING
Otter: OTTER_SQL_CONNECTION_STRINGUsing those variables, my original docker-compose file is working fine...
-