Sql-Agent not starting on an Ubuntu SQL Server docker container in an azure container

1.2k views Asked by At

I am using docker to deploy an linux sql-server to azure.

And I cannot get the Sql-Server agent to run on a container instance on Ubuntu in azure. The Sql-Server starts fine but not the Sql-Agent. I have tried with different versions of SQL-Server.

Locally it works fine with this example:

docker run -d -p 15789:1433 `
--env ACCEPT_EULA=Y `
--env SA_PASSWORD=Testing1122 `
--env MSSQL_AGENT_ENABLED=True `
--name testcontainer `
mcr.microsoft.com/mssql/server:2019-GDR1-ubuntu-16.04

enter image description here

But when adding the same image to azure container registry and then to an container instance it is not working:

enter image description here

In the log for the container I can see the following error which I am not sure if it is correlated to that the agent is not starting:

2020-10-20 14:36:24.91 spid35s     Error: 39002, Severity: 16, State: 1.
2020-10-20 14:36:24.91 spid35s     SQL failed to boot extensibility for error code 0x80070005.
2020-10-20 14:36:24.91 spid35s     InitializeXdbPkgLauncher failed. ErrorCode: 0x80004005.

Someone that knows why this isnt working or how it can be fixed to be able to run it in an azure container instance?

2

There are 2 answers

5
Charles Xu On

According to my test, the image mcr.microsoft.com/mssql/server:2019-GDR1-ubuntu-16.04 has the same error both in local and the Azure Container Instance. The issue shows here that it's a bug in SQL Server 2019. And I try to use the image mcr.microsoft.com/mssql/server:2017-CU21-ubuntu-16.04 and there is no problem. If you do not mind, try it.

2
user15566505 On

We had a similar issue and we found out that this is due to a limitation that exists in azure container instances: sql agent can't be enabled (looks enabled but in reality it isn't) when the instance name is greater than 15 characters long. Unfortunately, instance names are auto-assigned by the Kubernetes cluster at container creation time and you have no control over that. Vote for this idea if you would like the issue to be addressed (https://feedback.azure.com/forums/602224-azure-container-instances/suggestions/42509800-support-setting-of-hostname).