Docker Community Forums

Share and learn in the Docker community.

Installing SQL Express on microsoft/windowsservercore ~ System Can't find the file specified


(Kira Resari) #1

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


(Kira Resari) #2

Okay, so I have now managed to figure out why the docker run command didn’t work:

The problem was an ultimately simple syntax error in the ‘‘docker run’’ command that ultimately causes this misleading error message.

They syntax I used was:

docker run sqltest --name sqltest_container -p 1433:1433

However, the correct syntax is:

docker run --name sqltest_container -p 1433:1433 sqltest 

Since this took me a long time to figure out due to the misleading error message, here’s my request to the Docker Development Team: Please adjust the error message that comes in this point to give other users at least a hint that the cause of the problem might lie with the syntax of the ‘‘docker run’’ command, such as “The final component of ‘‘docker run’’ has to be an image name”.

Now I can run the container, but the SQL Express Service does not run inside it, and if I try to explicitly start it, the second error described above occurs.


(Richardgavel) #3

When I need to customize an existing image like you had to do, I start with their Dockerfile (and the SQL server Dockerfile are available in GitHub). That way, I can start from a known working file.


(Kira Resari) #4

Hi richardgavel,

thank you for your reply. I have tried out a number of different tutorials and samples for SQL Server, including some from GitHub, but none of them worked for me.

When you say that “the SQL server Dockerfile are available in GitHub”, might I ask which one you refer to?

Best wishes,
Kira Resari


(Richardgavel) #5

The authoritative one for MS’s own image: https://hub.docker.com/r/microsoft/mssql-server-windows-express/

Go to the “Supported tags and respective Dockerfile links” section and pick the Dockerfile you’re interested in.


(Kira Resari) #6

Hm, interesting. Thank you very much. I did not know it was possible to inspect Dockerfiles of public images like that. This is very helpful!

Yes, this should provide me with some insight on the issue. Thank you very much for your assistance!

Kira Resari
=^,^=