0

I am using mssql server image in Azure Container Instance.

Without mounting any volumes, ACI is created successfully and works fine. But when I mount a volume, to persist data even after restart of the container, made of Azure Storage account (File share), ACI is created successfully but the database could not be accessed.

log and secrets folders are created in the File share (acishare) but the data is not generated in the File share.

Could anyone provide detailed steps to resolve it or to Create an ACI with File share as volume to the mssql server docker image.

[Azure bash commands to create ACI with a Azure file share volume mounted]

ACI_PERS_RESOURCE_GROUP=PC
ACI_PERS_STORAGE_ACCOUNT_NAME=pcs1
ACI_PERS_LOCATION=eastus
ACI_PERS_SHARE_NAME=acishare
STORAGE_KEY=$(az storage account keys list --resource-group $ACI_PERS_RESOURCE_GROUP --account-name $ACI_PERS_STORAGE_ACCOUNT_NAME --query "[0].value" --output tsv)

az container create \
--resource-group $ACI_PERS_RESOURCE_GROUP \
--name pcs5 \
--image mcr.microsoft.com/mssql/server \
--dns-name-label pcs5 \
--ports 80 443 1433 \
--azure-file-volume-account-name $ACI_PERS_STORAGE_ACCOUNT_NAME \
--azure-file-volume-account-key $STORAGE_KEY \
--azure-file-volume-share-name $ACI_PERS_SHARE_NAME \
--azure-file-volume-mount-path /var/opt/mssql/ \
--memory 2.5 \
--environment-variables 'SA_PASSWORD'='PxSecret123' 'ACCEPT_EULA'='Y' 'MSSQL_PID=Express'
Naveen Kumar V
  • 2,559
  • 2
  • 29
  • 43

1 Answers1

1

The reason that the ACI is created successfully but cannot be accessible is that the mssql server does not run as normal. When you mount the Azure File Share to the path /var/opt/mssql of the container, then the file share overwrites all the files in it. But the files are necessary for the mssql server to run. So the server fails to start.

The possible solution is to mount the File Share to a new path that does not exist or does not affect the running of the mssql server. And then you need to transfer the data you want to the mount path manually. It's not a good solution. but now there is no better solution due to the limitation of the File Share mount.

Charles Xu
  • 29,862
  • 2
  • 22
  • 39
  • Thanks for detailed response. If File Share is limited, how can we mount a volume to persist the DB data against the container crash/restart? I need to run MSSQL Server with persisted data either in windows or linux container. Any idea? – Naveen Kumar V Sep 11 '20 at 13:46
  • 1
    @NaveenKumarV The Azure File Share only supports the Linux. And as I said in the answer, you need to mount to a new folder and transfer the data to it manually. – Charles Xu Sep 14 '20 at 01:28
  • @NaveenKumarV Do you solve the problem? If it works for you please accept it as the answer. – Charles Xu Sep 15 '20 at 07:11