When I try installing MSSQL 2014 Express in Dockerfile, it fails with error "Value cannot be null. Parameter name: userName".
The following error occurred:
Value cannot be null.
Parameter name: userName
Error result: -2147467261
Result facility code: 0
Result error code: 16387
Please review the summary.txt log for further details
Microsoft (R) SQL Server 2014 12.00.5000.00
Copyright (c) Microsoft Corporation. All rights reserved.
The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; cd extracted; ./setup.exe /q /ACTION=Install /INSTANCENAME=SQLEXPRESS /FEATURES=SQLEngine /UPDATEENABLED=0 /SQLSVCACCOUNT="NT AUTHORITY\System" /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS" /TCPENABLED=1 /NPENABLED=0 /IACCEPTSQLSERVERLICENSETERMS' returned a non-zero code: 1
This is how my Dockerfile looks like (irrelevant parts omitted):
FROM microsoft/windowsservercore
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
COPY SQLEXPR_x64_ENU.exe ./
RUN .\SQLEXPR_x64_ENU.exe /x:extracted /u
RUN cd extracted; ./setup.exe /q /ACTION=Install /INSTANCENAME=SQLEXPRESS /FEATURES=SQLEngine /UPDATEENABLED=0 /SQLSVCACCOUNT="NT AUTHORITY\System" /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS" /TCPENABLED=1 /NPENABLED=0 /IACCEPTSQLSERVERLICENSETERMS
The strange thing is, when I replace the last RUN command with ENTRYPOINT powershell, start the container and then run the exact same command, it works and the error isn't thrown.
The only thing I suspect to be a problem is that docker runs commands as "no user". But...
This is a result of whoami command in running container:
user manager\containeradministrator
I have tried putting RUN whoami to Dockerfile to confirm my hypothesis but the output is the same.
I have no idea what else to do, so thanks for any suggestions :).
So I've finally found what causes the problem. The error occurs when using powershell as default shell (SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"])
I made it work by skipping SHELL command and running installations from default command line.
RUN /SQLEXPR_x64_ENU.exe /qs /x:setup
RUN /setup/setup.exe /q /ACTION=Install /INSTANCENAME=SQLEXPRESS /FEATURES=SQLEngine /UPDATEENABLED=0 /SQLSVCACCOUNT="NT AUTHORITY\System" /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS" /TCPENABLED=1 /NPENABLED=0 /IACCEPTSQLSERVERLICENSETERMS
MSSQL 2008, 2012 and 2016 all work ok with powershell, only 2014 has this issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With