moby: Windows Container - spooler service crashes without warning
Description
Print spooler stops without displaying a warning when you use powershell cmdlets like get-printer
Steps to reproduce the issue:
Tested with Windowsservercore:1709 and windowsservercore
docker run -it microsoft/windowsservercore PS
install-windowsfeature Print-server
Set-Service spooler -StartupType Automatic
Start-Service spooler
Get-Service spooler
Get-Printer
Describe the results you received:
PS C:\> get-printer
get-printer : The spooler service is not reachable. Ensure the spooler service is running.
At line:1 char:1
get-printer ~~~~~~~~~~~
CategoryInfo : NotSpecified: (MSFT_Printer:ROOT/StandardCimv2/MSFT_Printer)
[Get-Printer], CimException
FullyQualifiedErrorId : HRESULT 0x800706ba,Get-Printer
Describe the results you expected:
PS C:\Windows\system32> get-printer
Name ComputerName Type DriverName PortN
ame
---- ------------ ---- ---------- -----
Microsoft XPS Document Writer Local Microsoft XPS Document... PO...
Microsoft Print to PDF Local Microsoft Print To PDF PO...
Output of docker version:
PS C:\Windows\system32> docker version
Client:
Version: 17.06.2-ee-10
API version: 1.30
Go version: go1.8.7
Git commit: 66261a0
Built: Fri Apr 27 00:42:30 2018
OS/Arch: windows/amd64
Server:
Engine:
Version: 17.06.2-ee-10
API version: 1.30 (minimum version 1.24)
Go version: go1.8.7
Git commit: 66261a0
Built: Fri Apr 27 00:54:58 2018
OS/Arch: windows/amd64
Experimental: false
Output of docker info
:
Client:
Version: 17.06.2-ee-10
API version: 1.30
Go version: go1.8.7
Git commit: 66261a0
Built: Fri Apr 27 00:42:30 2018
OS/Arch: windows/amd64
Server:
Engine:
Version: 17.06.2-ee-10
API version: 1.30 (minimum version 1.24)
Go version: go1.8.7
Git commit: 66261a0
Built: Fri Apr 27 00:54:58 2018
OS/Arch: windows/amd64
Experimental: false
PS C:\Windows\system32>
PS C:\Windows\system32> docker info
Containers: 12
Running: 1
Paused: 0
Stopped: 11
Images: 3
Server Version: 17.06.2-ee-10
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: l2bridge l2tunnel nat null overlay transparent
Log: awslogs etwlogs fluentd json-file logentries splunk syslog
Swarm: inactive
Default Isolation: process
Kernel Version: 10.0 16299 (16299.15.amd64fre.rs3_release.170928-1534)
Operating System: Windows Server Datacenter
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 16GiB
Name: Server1709
ID: POWN:PUNA:BC5K:EKRP:73XO:J4JQ:YCRT:JF3R:HEAW:STSP:Y6RB:LXX3
Docker Root Dir: C:\ProgramData\docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 60 (9 by maintainers)
We have enabled this service within the new windows image (https://hub.docker.com/r/microsoft/windows-insider/).
I can’t believe it! Printing works on a Windows Server (1903) with process isolation. One container and no problems. Now the real software can be tested. Hope to hear from Windows Desktop as a host some time 😁
I executed -
docker run -it mcr.microsoft.com/windows/servercore:ltsc2019 powershell
to get the below result within the container on a Windows Server 2019;Version 1809 [OS Build 17763.134]-Still fail to install Print-Services.
@cwilhit @taylorb-microsoft I believe there’s an issue with accessing printing in Hyper-V isolation in general. I’m also receiving the same errors as @themultiplexer even when attempting basic printing from within a Hyper-V isolated printer on the latest Windows Server 1903.
I’ve tested using the below powershell snippet to ensure no custom code nor custom drivers would be causing any interference. This uses the pre-installed Microsoft Print to PDF printer that’s automatically availlable in Windows Server 1903.
(Replace $sourcetxtfile and $destpdffile with whatever location and file you wish)
If this is executed under process-isolation, it does what is expected and converts the text file to pdf, but if executed under hyper-v isolation I receive the following :
From personal experience on non-containers, this is usually caused by either a typo in the settings or a driver issue.
But the following is also logged :
Also this :
@themultiplexer I repro’ed with your new test without UI and was successful in getting the “hello world” out.pdf file. Host was Windows Server, guest was
mcr.microsoft.com/windows:1809
, configured as our documentation suggests for running a process-isolated container.@cwilhit Could we get clarification on what printing functions are supposed to work under Hyper-V Isolation?
The document (https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/print-spooler) suggests that we should be using Hyper-V isolated containers to get around the one container limit of process isolation.
But as shown, even the most basic printing using the pre-installed pdf printer doesn’t work
@jasonbivins Folks, they just published a new doc! A big thanks to @cwilhit @taylorb-microsoft https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/print-spooler
Looping in @cwilhit (PM for the windows image)
The XPS document writer printer is already installed when I checked in the latest windows image (mcr.microsoft.com/windows:1809). I am seeing the same error codes you are, however those are being returned from the WMI wrappers around the PrinterSpooler APIs (https://docs.microsoft.com/en-us/windows/desktop/printdocs/printing-and-print-spooler-functions) - implication being that while something we should debug it may not preclude functionality.
@taylorb-microsoft actually spooler and its media was removed from image on 1803.
@sujaypillai spooler works just fine as after you got it instaled. Here is how we do it:
Also see my comment about how to avoid spooler crashing: https://stackoverflow.com/questions/41565459/windows-2016-docker-container-error/50748146#50748146
Printers are available inside the windows-insider image and my program just runs fine 👍. When will combined images like: aspnet:4.7.2-windowsservercore-ltsc2019 be supported? TIA