I am trying to build a docker image to create a windows container later on. Here is my Dockerfile
FROM mcr.microsoft.com/windows/servercore:ltsc2019
ENV sa_password=YourStrong!Passw0rd
ENV ACCEPT_EULA=Y
RUN powershell -Command
$ErrorActionPreference = 'Stop';
Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/?linkid=866658" -OutFile "C:\SQLServer2019.exe";
Start-Process -FilePath "C:\SQLServer2019.exe" -ArgumentList '/QS', '/ACTION=Download', '/MEDIAPATH=C:\SQLServer2019', '/IACCEPTSQLSERVERLICENSETERMS' -NoNewWindow -Wait;
Start-Process -FilePath "C:\SQLServer2019\setup.exe" -ArgumentList '/QS', '/ACTION=Install', '/FEATURES=SQL', '/INSTANCENAME=MSSQLSERVER', '/SQLSVCACCOUNT="NT AUTHORITY\SYSTEM"', '/SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS"', '/AGTSVCACCOUNT="NT AUTHORITY\SYSTEM"', '/SECURITYMODE=SQL', '/SAPWD="YourStrong!Passw0rd"', '/IACCEPTSQLSERVERLICENSETERMS' -NoNewWindow -Wait;
Remove-Item -Path "C:\SQLServer2019.exe" -Force;
Remove-Item -Path "C:\SQLServer2019" -Recurse -Force
EXPOSE 1433
# Start SQL Server
CMD ["powershell", "-Command", "Start-Service MSSQLSERVER; Wait-Event -Timeout 2147483647"]
I got an annoying error:
Step 1/6 : FROM mcr.microsoft.com/windows/servercore:ltsc2019
ltsc2019: Pulling from windows/servercore
cb524f6f2215: Pulling fs layer
3b96cede01b4: Pulling fs layer
3b96cede01b4: Verifying Checksum
3b96cede01b4: Download complete
cb524f6f2215: Verifying Checksum
cb524f6f2215: Download complete
cb524f6f2215: Pull complete
3b96cede01b4: Pull complete
Digest: sha256:0d52390e8497ea6238500afbf60054bd731b12818e6440d31fe6ff4e2eefc5ad
Status: Downloaded newer image for mcr.microsoft.com/windows/servercore:ltsc2019
---> 0d0007bbd07e
Step 2/6 : ENV sa_password=YourStrong!Passw0rd
---> Running in 94e8a026c2d0
---> Removed intermediate container 94e8a026c2d0
---> f3720275809b
Step 3/6 : ENV ACCEPT_EULA=Y
---> Running in be637d92c86a
---> Removed intermediate container be637d92c86a
---> b87e047d63d8
Step 4/6 : RUN powershell -Command $ErrorActionPreference = 'Stop'; Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/?linkid=866658" -OutFile "C:\SQLServer2019.exe"; Start-Process -FilePath "C:\SQLServer2019.exe" -ArgumentList '/QS', '/ACTION=Download', '/MEDIAPATH=C:\SQLServer2019', '/IACCEPTSQLSERVERLICENSETERMS' -NoNewWindow -Wait; Start-Process -FilePath "C:\SQLServer2019\setup.exe" -ArgumentList '/QS', '/ACTION=Install', '/FEATURES=SQL', '/INSTANCENAME=MSSQLSERVER', '/SQLSVCACCOUNT="NT AUTHORITY\SYSTEM"', '/SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS"', '/AGTSVCACCOUNT="NT AUTHORITY\SYSTEM"', '/SECURITYMODE=SQL', '/SAPWD="YourStrong!Passw0rd"', '/IACCEPTSQLSERVERLICENSETERMS' -NoNewWindow -Wait; Remove-Item -Path "C:\SQLServer2019.exe" -Force; Remove-Item -Path "C:\SQLServer2019" -Recurse -Force
---> Running in 88d6369357ef
hcs::CreateComputeSystem 88d6369357ef599840e60e41713cd2e1b36ba642d19472affbf372c5178943be: The container operating system does not match the host operating system
I just do not get it. All I want is a SQL server database windows based running with docker. How can I rewrite my dockerfile in a way that just works out of the box.
Keep in mind that:
Linux containers is not an option for my situation right now.
I found out that my link is wrong. I really need SQL server enterprise.
How you can help me:
Provide a docker file that just works out of the box to run SQL server enterprise.
Respect that I really need windows containers. The reasons for that are out scope of this question.
1