首页 > 解决方案 > 在 Windows 容器中运行的 Windows Server Core 2019 上的 SQL Server 2012 设置失败

问题描述

我正在尝试在运行 Windows Core Server 2019 的 Windows 容器中安装 SQL Server 2012 Developer Edition。我编写了一个 Dockerfile 并将 SQL Server 2012 安装文件复制到 Docker 构建上下文中(磁盘上 4.94 GB)。我宁愿不必在构建上下文中包含安装程序,但我没有可用于托管文件的 Web 服务器。当我运行 setup.exe 时,我没有看到指示失败的诊断消息,但日志文件 SqlSetup.log 在文件末尾包含消息“Setup closed with exit code: 0x84C40013”。

这是我的 Dockerfile:

# escape=`
FROM mcr.microsoft.com/windows/servercore:ltsc2019

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

# Before doing a Docker build, copy the following folder from \\filesrv01\Software\Databases\All Database Software\Microsoft ...
COPY en_sql_server_2012_developer_edition_x86_x64_dvd_813280/ C:\sql_server_2012

# Copy script to set up SQL Server
COPY set-up-sql-server.cmd C:\

这是我的 SQL Server 2012 安装脚本 setup-sql-server.cmd:

C:\sql_server_2012\setup.exe /q /ACTION=Install /FEATURES=SQLEngine /INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT="NT AUTHORITY\Network Service" /SQLSYSADMINACCOUNTS="NT AUTHORITY\Network Service" /AGTSVCACCOUNT="NT AUTHORITY\Network Service" /IACCEPTSQLSERVERLICENSETERMS

这是我的 PowerShell 会话的摘录:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\mmorey\Documents\git\docker-mssql\2012> docker run --interactive --tty mssql-2012
Microsoft Windows [Version 10.0.17763.1040]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\>set-up-sql-server.cmd

C:\>C:\sql_server_2012\setup.exe /q /ACTION=Install /FEATURES=SQLEngine /INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT="NT AUTHORITY\Netwo
rk Service" /SQLSYSADMINACCOUNTS="NT AUTHORITY\Network Service" /AGTSVCACCOUNT="NT AUTHORITY\Network Service" /IACCEPTSQLSERVERLICEN
SETERMS
Microsoft (R) SQL Server 2012 11.00.2100.60
Copyright (c) Microsoft Corporation.  All rights reserved.

Microsoft .NET Framework CasPol 4.7.3190.0
for Microsoft .NET Framework version 4.7.3190.0
Copyright (C) Microsoft Corporation.  All rights reserved.

WARNING: The .NET Framework does not apply CAS policy by default. Any settings shown or modified by CasPol will only affect
applications that opt into using CAS policy.

Please see http://go.microsoft.com/fwlink/?LinkId=131738 for more information.


Success
Microsoft .NET Framework CasPol 4.7.3190.0
for Microsoft .NET Framework version 4.7.3190.0
Copyright (C) Microsoft Corporation.  All rights reserved.

WARNING: The .NET Framework does not apply CAS policy by default. Any settings shown or modified by CasPol will only affect
applications that opt into using CAS policy.

Please see http://go.microsoft.com/fwlink/?LinkId=131738 for more information.


Success

C:\>cd Users

C:\Users>dir *.log /s
 Volume in drive C has no label.
 Volume Serial Number is E4BB-38D4

 Directory of C:\Users\All Users\Microsoft\Windows\WER\ReportQueue\Critical_10.0.17763.850_464a773e8edf25185cd88a761afde13fe6f97325_
00000000_cab_0199d07a

03/02/2020  11:25 AM         1,227,459 CBS.log
           1 File(s)      1,227,459 bytes

 Directory of C:\Users\ContainerAdministrator\AppData\Local\Temp

03/02/2020  11:27 AM           102,216 SqlSetup.log
               1 File(s)        102,216 bytes

     Total Files Listed:
               2 File(s)      1,329,675 bytes
               0 Dir(s)  19,351,437,312 bytes free

C:\Users>more C:\Users\ContainerAdministrator\AppData\Local\Temp\SqlSetup.log
03/02/2020 11:23:38.007 ======================================================================
03/02/2020 11:23:38.007 Setup launched
03/02/2020 11:23:38.007 Attempting to determine media source
03/02/2020 11:23:38.007 Media source value not specified on command line argument.
03/02/2020 11:23:38.022 Setup is launched from media directly so default the value to the current folder.
03/02/2020 11:23:38.022 Media source: C:\sql_server_2012\
03/02/2020 11:23:38.022 Attempt to determine media layout based on file 'C:\sql_server_2012\mediainfo.xml'.
03/02/2020 11:23:38.241 Media layout is detected as: Full
03/02/2020 11:23:38.241 Not a slip stream media, so continuing to run setup.exe from media.
03/02/2020 11:23:38.257 SQM key not found
03/02/2020 11:23:38.257 /? or /HELP or /ACTION=HELP specified: false
03/02/2020 11:23:38.257 Help display: false
03/02/2020 11:23:38.257 Server-Gui-Mgmt: 0, Server-Gui-Shell: 0
03/02/2020 11:23:38.272 .Net version 4.0 is installed
03/02/2020 11:23:38.272 Local setup.exe not found, so continuing to run setup.exe from media.
03/02/2020 11:23:38.272 Attempt to initialize SQL setup code group
03/02/2020 11:23:38.272 Attempting to determine security.config file path
03/02/2020 11:23:38.272 Checking to see if policy file exists C:\Windows\Microsoft.NET\Framework64\v4.0.30319\\CONFIG\security.confi
g
03/02/2020 11:23:38.289 .Net security policy file does not exist
03/02/2020 11:23:38.289 Attempting to create .Net security policy file
03/02/2020 11:23:39.795 Attempting to load .Net security policy file
.
.
.
03/02/2020 11:23:40.078 Saved .Net security policy file
03/02/2020 11:23:40.078 Attempting to determine security.config file path
03/02/2020 11:23:40.078 Checking to see if policy file exists  C:\Windows\Microsoft.NET\Framework\v4.0.30319\\CONFIG\security.config
03/02/2020 11:23:40.095 .Net security policy file does not exist
03/02/2020 11:23:40.095 Attempting to create .Net security policy file
03/02/2020 11:23:41.588 Attempting to load .Net security policy file
.
.
.
03/02/2020 11:23:41.691 Saved .Net security policy file
03/02/2020 11:23:41.726 Strong name verification disabling is not required
03/02/2020 11:23:41.726 /? or /HELP or /ACTION=HELP specified: false
03/02/2020 11:23:41.726 Help display: false
03/02/2020 11:23:41.726 Attempting to launch landing page workflow
03/02/2020 11:23:41.726 Attempting to set setup mutex
03/02/2020 11:23:41.726 Setup mutex has been set
03/02/2020 11:23:41.726 Attempting to launch global rules workflow
03/02/2020 11:23:41.726 Media source: C:\sql_server_2012\
03/02/2020 11:23:41.741 Install media path: C:\sql_server_2012\x64\setup\
03/02/2020 11:23:41.743 Media layout: Full
03/02/2020 11:23:41.743 Attempting to get execution timestamp
03/02/2020 11:23:41.743 Timestamp: 20200302_112338
03/02/2020 11:23:41.743 Attempting to run workflow RUNRULES /RULES=GlobalRules
03/02/2020 11:23:41.743 Attempting to launch process C:\sql_server_2012\x64\ScenarioEngine.exe
03/02/2020 11:23:49.445 Process returned exit code: 0x00000000
03/02/2020 11:23:49.461 Workflow RUNRULES /RULES=GlobalRules returned exit code: 0x00000000
03/02/2020 11:23:49.461 Attempting to launch component update workflow
03/02/2020 11:23:49.461 Media source: C:\sql_server_2012\
03/02/2020 11:23:49.461 Install media path: C:\sql_server_2012\x64\setup\
03/02/2020 11:23:49.461 Media layout: Full
03/02/2020 11:23:49.461 Attempting to get execution timestamp
03/02/2020 11:23:49.461 Timestamp: 20200302_112338
03/02/2020 11:23:49.476 Attempting to run workflow COMPONENTUPDATE
03/02/2020 11:23:49.476 Attempting to launch process C:\sql_server_2012\x64\ScenarioEngine.exe
03/02/2020 11:24:59.261 Process returned exit code: 0x00000000
03/02/2020 11:24:59.272 Workflow COMPONENTUPDATE returned exit code: 0x00000000
03/02/2020 11:24:59.272 Attempting to launch user requested workflow locally
03/02/2020 11:24:59.272 Attempting to find local setup.exe
03/02/2020 11:24:59.272 Local bootstrap folder path: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\
03/02/2020 11:24:59.286 Local ScenarioEngine.exe full path: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\SQLServer2012\
x64\ScenarioEngine.exe
03/02/2020 11:24:59.286 Media source: C:\sql_server_2012\
03/02/2020 11:24:59.286 Install media path: C:\sql_server_2012\x64\setup\
03/02/2020 11:24:59.286 Media layout: Full
03/02/2020 11:24:59.302 Attempting to get execution timestamp
03/02/2020 11:24:59.302 Timestamp: 20200302_112338
03/02/2020 11:24:59.302 Attempting to run user requested action from local ScenarioEngine.exe
03/02/2020 11:24:59.302 Attempting to launch process C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\SQLServer2012\x64\Sce
narioEngine.exe
03/02/2020 11:27:42.901 Process returned exit code: 0x85940001
03/02/2020 11:27:42.917 Local ScenarioEngine.exe returned exit code: 0x85940001
03/02/2020 11:27:42.949 Attempting to load .Net security policy file C:\Windows\Microsoft.NET\Framework64\v4.0.30319\\CONFIG\securit
y.config
03/02/2020 11:27:43.045 Attempting to remove .Net security code group node
.
.
.
03/02/2020 11:27:44.682 Saved .Net security policy file
03/02/2020 11:27:44.682 Attempting to release setup mutex
03/02/2020 11:27:44.698 Setup mutex has been released
03/02/2020 11:27:44.698 Setup closed with exit code: 0x84C40013
03/02/2020 11:27:44.698 ======================================================================

C:\Users>

没有具体的消息表明安装失败的性质,也没有说明要采取的步骤。

标签: sql-serverwindowsdocker

解决方案


我能够通过更改 Dockerfile FROM 指令以切换到 Microsoft .NET 3.5 Framework SDK/Server Core 2019 映像来解决此问题:

FROM mcr.microsoft.com/dotnet/framework/sdk:3.5-20191008-windowsservercore-ltsc2019

这是因为 Microsoft SQL Server 2012 需要 Microsoft .NET 3.5 Framework SDK 作为先决条件。


推荐阅读