我在docker中运行microsoft/windowsservercore:1803
:
docker run -it microsoft/windowsservercore:1803
在其中,我启动 powershell 并运行Get-WindowsCapability
cmdlet 并得到以下输出:
PS C:\> Get-WindowsCapability -online
Get-WindowsCapability : The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.
At line:1 char:1
+ Get-WindowsCapability -online
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WindowsCapability], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.GetWindowsCapabilityCommand
它指的是什么服务?我可以设置容器以便允许我运行该服务或Add-WindowsCapability
cmdlet 吗?
最终,我想要运行[微软官方分发的] OpenSSH 服务器。
更新。我检查了容器中的 Windows Update 和 TrustedInstaller 服务的状态(正如评论中所建议的那样):前者已被禁用,因此我启用了它:
Set-Service -Name wuauserv -StartupType Manual
Start-Service -name wuauserv
然后再次尝试运行Get-WindowsCapability
:
PS C:\> Get-WindowsCapability -online
Get-WindowsCapability : Get-WindowsCapability failed. Error code = 0x80d03805
At line:1 char:1
+ Get-WindowsCapability -online
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WindowsCapability], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.GetWindowsCapabilityCommand
仍然不起作用,但是错误现在不同了。
这是我在 EventLog 中看到的内容:
PS C:\> Get-EventLog system
Index Time EntryType Source InstanceID Message
----- ---- --------- ------ ---------- -------
312 Jun 24 14:07 Information Service Control M... 1073748860 The Windows Update service entered the stopped state.
311 Jun 24 14:01 Information Service Control M... 1073748860 The Remote Registry service entered the stopped state.
310 Jun 24 13:59 Information Service Control M... 1073748860 The Windows Error Reporting Service service entered the stopped state.
309 Jun 24 13:59 Information Service Control M... 1073748860 The Windows Modules Installer service entered the stopped state.
308 Jun 24 13:57 Information Service Control M... 1073748860 The Windows Error Reporting Service service entered the running state.
307 Jun 24 13:57 Error DCOM 10001 The description for Event ID '10001' in Source 'DCOM' cannot be found. The local computer may not have the necessary registry information or message DLL files to display the message, or you may not have permission to access them. The following information is part of the event:'C:\Windows\system32\...
306 Jun 24 13:57 Error DCOM 10001 The description for Event ID '10001' in Source 'DCOM' cannot be found. The local computer may not have the necessary registry information or message DLL files to display the message, or you may not have permission to access them. The following information is part of the event:'C:\Windows\system32\...
305 Jun 24 13:57 Information Service Control M... 1073748860 The Delivery Optimization service entered the running state.
304 Jun 24 13:57 Information Microsoft-Windows... 44 Windows Update started downloading an update.
303 Jun 24 13:57 Information Service Control M... 1073748860 The Windows Modules Installer service entered the running state.
302 Jun 24 13:57 Information Service Control M... 1073748860 The Windows Update service entered the running state.
这两条错误信息是:
无法找到源“DCOM”中事件 ID“10001”的描述。本地计算机可能没有显示消息所需的注册表信息或消息 DLL 文件,或者您没有访问它们的权限。以下信息是事件的一部分:“C:\Windows\system32\DllHost.exe /Processid:{AA65DD7C-83AC-48C0-A6FD-9B61FEBF8800}”,“0”,“{AA65DD7C-83AC-48C0-A6FD-9B61FEBF8800}”,“Unavailable”,“Unavailable”
无法找到源“DCOM”中事件 ID“10001”的描述。本地计算机可能没有显示消息所需的注册表信息或消息 DLL 文件,或者您没有访问它们的权限。以下信息是事件的一部分:“C:\Windows\system32\DllHost.ex /Processid:{AA65DD7C-83AC-48C0-A6FD-9B61FEBF8800}”,“1008”,“{AA65DD7C-83AC-48C0-A6FD-9B61FEBF8800}”,“不可用”,“不可用”