在Windows docker contaiener容器上安装打印服务器失败

问题描述

我正在重新运行mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019 我尝试做的第一件事是安装Print-Server,但给我一个错误(这是我第一次使用powershell安装Windows功能):

add-WindowsFeature -Name Print-Server

add-WindowsFeature : The request to add or remove features on the specified server failed.
Installation of one or more roles,role services,or features failed.
The source files could not be found.
Use the "Source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source
location,see http://go.microsoft.com/fwlink/?LinkId=243077. Error: 0x800f081f
At line:1 char:1
+ add-WindowsFeature -Name Print-Services -IncludeAllSubFeature
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (@{Vhd=; Credent...Name=localhost}:PSObject) [Install-WindowsFeature],Exception
    + FullyQualifiedErrorId : DISMAPI_Error__Failed_To_Enable_Updates,Microsoft.Windows.ServerManager.Commands.AddWindowsFeatureCommand

我尝试将主机WinSxS安装在容器中并使用sources文件夹,但出现相同的错误。

Install-WindowsFeature -Name Print-Server -Source c:\sources

我也尝试过与Enable-WindowsOptionalFeature在线,但给我这个错误:

PS C:\> Enable-WindowsOptionalFeature -Online -FeatureName Print-Server
Enable-WindowsOptionalFeature : Feature name Print-Server is unknown.
At line:1 char:1
+ Enable-WindowsOptionalFeature -Online -FeatureName Print-Server
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Enable-WindowsOptionalFeature],COMException
    + FullyQualifiedErrorId : Microsoft.Dism.Commands.EnableWindowsOptionalFeatureCommand

看看其他问题,这部分内容似乎是在为其他人工作。我正在运行Windows 10企业版2004。 有人知道我该怎么办吗?

解决方法

From here

mcr.microsoft.com/windows 映像应该是目标基础映像。 其他 Windows 容器基础映像(例如 Nano Server 和 Windows 服务器核心)不携带打印服务器角色。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...