[英]Adding printer on windows-docker
We are trying to dockerize some old powerbuilder batch jobs, and the existing code requires a ghostscript printer installed with the exact name (for the details see here)我们正在尝试对一些旧的 powerbuilder 批处理作业进行 docker 化,现有代码需要安装具有确切名称的 ghostscript 打印机(有关详细信息,请参见此处)
Microsoft's documentation on Print Spooler in containers states "apps that have a dependency on installing printer drivers into the host cannot be containerized because driver installation from within a container is unsupported"微软关于容器中打印后台处理程序的文档指出“依赖于将打印机驱动程序安装到主机中的应用程序不能被容器化,因为不支持从容器内安装驱动程序”
I do not know if this is just a typo/missunderstanding, as why would any application want to install driver into host?我不知道这是否只是一个错字/误解,为什么任何应用程序都想将驱动程序安装到主机中? I need it in the container, also is it only for the drivers or for the Printers as well?
我需要它在容器中,它是否也仅用于驱动程序或打印机?
Assuming this is only a typo/missunderstanding, and microsoft claims it can not be done in the container, the question is假设这只是一个错字/误解,微软声称它不能在容器中完成,问题是
Assuming this the above statement is not a typo/missunderstanding, than it should be possible to add printer to docker.假设上述陈述不是错字/误解,那么应该可以将打印机添加到 docker。 For that we are using
为此,我们正在使用
FROM mcr.microsoft.com/windows:1909
and isolation is hyperv和隔离是hyperv
We tried runnig this from the dockerfile我们尝试从 dockerfile
RUN powershell -command Add-Printer -Name \"Test Printer\" -DriverName \"Microsoft Print to PDF\" -PortName \"PORTPROMPT:\"
and get following errror并得到以下错误
# InvalidData: (MSFT_Printer:ROOT/StandardCimv2/MS
# FullyQualifiedErrorId : HRESULT 0x80070006,Add-Printer
but I was not able to find anything meangifull for this error但我无法为这个错误找到任何有意义的东西
I can list, rename and remove a printer but I can not add existing one, also if I execute我可以列出、重命名和删除一台打印机,但我不能添加现有的打印机,如果我执行
Get-PrintConfiguration "Microsoft Print To PDF"
I am getting我正进入(状态
+ CategoryInfo : NotSpecified: (MSFT_PrinterConfiguration:ROOT/StandardCi...erConfiguration) [Get-PrintConfiguration], CimException
+ FullyQualifiedErrorId : HRESULT 0x8000ffff,Get-PrintConfiguration
so it seams there is something fishy with printers in the docker image.所以它接缝在 docker 图像中的打印机有些可疑。
Do you if there is any possibility to add printer to docker image / container?您是否有可能将打印机添加到 docker 图像/容器?
thanks almir谢谢阿尔米尔
Probably your error in in the DockerFile command.可能是您在 DockerFile 命令中的错误。 You have to pass the hole command to the powershell and not just the Add-Printer.
您必须将孔命令传递给 powershell 而不仅仅是 Add-Printer。
I did not try it out, but i would do it like this:我没有尝试过,但我会这样做:
RUN powershell -command "Add-Printer -Name \"Test Printer\" -DriverName \"Microsoft Print to PDF\" -PortName \"PORTPROMPT:\""
The question is quite old, but i would be curios to have a beedback:)这个问题很老了,但我会很好奇有一个反馈:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.