1

I have been struggling for a few days to spin up a windows based docker container running SQL Server 2017 on Windows Server Core 2016. I am using the following image as a starting point:

https://hub.docker.com/r/microsoft/mssql-server-windows-developer

I managed to successfully install the container and get it running perfectly. When I attempt to restore my database, I get an error stating that the FILESTREAM feature is not enabled. I understand that FILESTREAM is not supported on Linux containers but this is a windows based container.

I have been spending the last few days trying to enable filestream. As this is a server core OS, there is now UI. So using SQL server configuration manager is not an option. At least not locally. I tried connecting to the machine remotely using MMC to manage it but I get an error saying that the computer cannot be remotely managed due to COM+ Network Access (DCOM-In) and all rules in the Remote Event Log Management group not being enabled on the Windows Firewall. Trying to add these rules in the docker container just results in a bunch of errors. I read somewhere that the container actually using the firewall on the host machine. I tried adding the required firewall rules on both the container and the host machine with the following command:

Invoke-Command -ComputerName localhost {Set-NetFirewallRule -DisplayGroup 'Remote Event Log Management' -Enabled True -PassThru | select DisplayName, Enabled}

This only results in Access Denied errors on both machines. I tried enabling FILESTREAM on the container using the following script:

# Enable FILESTREAM

$username = "LocalOSUserAccount"
$password = ConvertTo-SecureString "LocalOSUserAccountPassword" -AsPlainText -Force
$psCred = New-Object System.Management.Automation.PSCredential -ArgumentList ($username, $password)

$instance = Get-SqlInstance -MachineName "localhost" -Credential $psCred
$wmi = Get-WmiObject -Namespace "ROOT\Microsoft\SqlServer\ComputerManagement11" -Class FilestreamSettings | where {$_.InstanceName -eq $instance}
$wmi.EnableFilestream(3, $instance)
Get-Service -Name $instance | Restart-Service
 
Set-ExecutionPolicy RemoteSigned
Import-Module "sqlps" -DisableNameChecking
Invoke-Sqlcmd "EXEC sp_configure filestream_access_level, 2"
Invoke-Sqlcmd "RECONFIGURE"

but this also ended in tears with a instance cannot be found error.

Out of pure frustration, I finally ended up referencing the docker file for this image and creating my own. The original file can be found here:

https://github.com/microsoft/mssql-docker/tree/master/windows/mssql-server-windows-developer

The only thing that I changed was to add the /FILESTREAMLEVEL and the /FILESTREAMSHARENAME to the command line install of SQL Server as per https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt?view=sql-server-ver15 in the dockerfile.

With this strategy, I managed to create the image successfully with /FILESTREAMLEVEL=1 and omitting the /FILESTREAMSHARENAME parameter (not required for /FILESTREAMLEVEL=1). When I run the image though, the container is created, but the MSSQLSERVER service fails to start and the container shuts down. I need to find a way to trace this error somehow which I will investigate. It has to be FILESTREAM causing the service start to fail.

When I use /FILESTREAMLEVEL=2 and a /FILESTREAMSHARENAME=MSSQLSERVER, the image fails to build saying that the share MSSQLSERVER could not be validated. I investigated this and it seems you have to ensure that the "Server" service is started, I don't see that service in my container. Another way to enable it is to enable "Printer and File Sharing". Attempting to do this also results in a bunch of Access Denied errors.

Am I missing something very basic? I am fairly new to docker but this is a huge amount of struggle to enable FILESTREAM? Any help would be very much appreciated.

0

1 Answer 1

0

Not sure if this is the problem but the link you gave in the question says that the image was last updated 3 years ago:

enter image description here

Plus it says that:

"This image is compatible with Windows Server 2016 (Core, with Desktop)...

I'm concerned about that "with Desktop" but I cannot tell if this is the problem.

I would rather suggest you to use this one by running:

docker pull mcr.microsoft.com/mssql/server:2017-latest 

Let us know if it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.