Hello everyone,
I am trying to create a container that runs MS SQL Express on the microsoft/windowsservercore (because the microsoft/sqlexpress base image is apparently a lightweight version that is missing some essential components that mess up some of my later steps), but I am having trouble getting it to work, and despite having tried everything I can think of, I could not make any progress thus far.
Here is my Dockerfile:
# Starts with the windows servercore base image
FROM microsoft/windowsservercore
# Exposes port 1433
EXPOSE 1433
# Sets the Working Directory
WORKDIR /install
# Downloads SQL Express Installer
RUN powershell wget https://download.microsoft.com/download/9/0/7/907AD35F-9F9C-43A5-9789-52470555DB90/ENU/SQLEXPR_x64_ENU.exe -OutFile sqlexpr_x64_enu.exe
# Installs Thw SQL Express Installer
RUN /install/sqlexpr_x64_enu.exe /q /x:/install/setup
# Add the SQL Test Installation Files (C:/SQLTest/SQLInstall/configurationfile.ini)
ADD SQLTest/SQLInstall C:/SQLTest/SQLInstall
#Installs SQL Express
RUN /install/setup/setup.exe /q /IACCEPTSQLSERVERLICENSETERMS /ConfigurationFile=C:/SQLTest/SQLInstall/configurationfile.ini
I can build an image using this configuration just fine. However, when I try to run a container from this image, I get the following error message:
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: container f7b26fbe6e2361d4274013b335c7387acaceae7802ff908089d9fc93f6cb69ec encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: {"CommandLine":"--name sqltest_container","WorkingDirectory":"C:\\install","CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe":true,"ConsoleSize":[0,0]}.
While I am not 100% sure, I think this might be related to the fact that the SQL Server service - while existing in the container - fails to start after the installation, as I was able to confirm with an additional purely diagnostic RUN step:
Step 13/13 : RUN powershell get-service "MSSQL$*"
---> Running in 6aa3926abd3a
Status Name DisplayName
------ ---- -----------
Stopped MSSQL$SQLEXPRESS SQL Server (SQLEXPRESS)
I have also tried to explicitly run the service using:
RUN powershell start-service "MSSQL`$SQLEXPRESS"
âŠhowever, that only generates the following error message, without any further details that I can use for debugging the issue.
start-service : Failed to start service 'SQL Server (SQLEXPRESS)
(MSSQL$SQLEXPRESS)'.
At line:1 char:1
+ start-service MSSQL`$SQLEXPRESS
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.ServiceProcess.ServiceControl
ler:ServiceController) [Start-Service], ServiceCommandException
+ FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands
.StartServiceCommand
I have already tried researching all these issues, as well as tried a number of different approaches such as installing .NET Framework 3.5 on the container, but all of them have left me stranded at the âThe system cannot find the file specifiedâ/âFailed to start serviceâ errors at the end.
I am at my witâs end here and need some fresh input on this matter. If anyone has any ideas about what I can try in order to get this to work, that would be greatly appreciated.
Thanks in advance,
Kira