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


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 SA_PASSWORD=Testing1122 `
--name testcontainer `

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?

asked on Stack Overflow Oct 20, 2020 by Sgedda • edited Oct 20, 2020 by Sgedda

2 Answers


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).

answered on Stack Overflow Apr 6, 2021 by user15566505

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.

answered on Stack Overflow Oct 21, 2020 by Charles Xu

User contributions licensed under CC BY-SA 3.0