Skip to content

add 2016 express win dockerfile #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM microsoft/windowsservercore

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]

#SQL Server Express 2016 (64 bit) 13.0.1601.5
ENV DOWNLOAD_URL https://download.microsoft.com/download/E/1/2/E12B3655-D817-49BA-B934-CEB9DAC0BAF3/SQLEXPR_x64_ENU.exe

ENV SA_PASSWORD _

RUN (New-Object System.Net.WebClient).DownloadFile($env:DOWNLOAD_URL, 'Setup.exe') ; \
Start-Process -FilePath '\Setup.exe' \
-ArgumentList '/Q', \
'/ACTION=Install', \
'/FEATURES=SQLEngine', \
'/INSTANCENAME=MSSQLServer', \
'/TCPENABLED=1', \
'/NPENABLED=0', \
'/UPDATEENABLED=0', \
'/SQLSVCACCOUNT="""NT AUTHORITY\System"""', \
'/SQLSYSADMINACCOUNTS="""BUILTIN\ADMINISTRATORS"""', \
'/IAcceptSQLServerLicenseTerms', \
'/SAPWD=Password1', \
'/SECURITYMODE=SQL' \
-Wait ; \
Stop-Service mssqlserver ; \
set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql13.MSSQLServer\mssqlserver\supersocketnetlib\tcp\ipall' -name tcpdynamicports -value '' ; \
set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql13.MSSQLServer\mssqlserver\supersocketnetlib\tcp\ipall' -name tcpport -value 1433 ; \
set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql13.MSSQLServer\mssqlserver\\' -name LoginMode -value 2 ; \
Remove-Item Setup.exe

RUN [Environment]::SetEnvironmentVariable('PATH', $env:ProgramFiles + '\Microsoft SQL Server\130\Tools\Binn;' + $env:PATH, [EnvironmentVariableTarget]::Machine);

CMD Start-Service mssqlserver ; \
if ($env:SA_PASSWORD -ne '_') { \
Write-Host Changing SA login credentials...; \
$sqlcmd = 'ALTER LOGIN sa with password=''' + $env:SA_PASSWORD + ''';'; \
Invoke-Sqlcmd -Query $sqlcmd -ServerInstance 'localhost,1433' \
} ; \
Write-Host SQL Server started... ; \
while ($true) { Start-Sleep -Seconds 3600 }

EXPOSE 1433