Dockerize an ASP.Net service that needs to print

Viewed 48

I have a set of services that I would like to dockerize. The dockerizing part went fine, I get the source from our private repositories, buidl them in a SDK-enabled machine, and publish the results to a mcr.microsoft.com/dotnet/aspnet:3.1 machine.

Building/Running work fine.

docker build -t printer_service .

docker run --name printer-api -p 44355:80 printer_service

Then I call the service: curl --location --request POST 'http://localhost:44355/api/Home' \ --header 'Content-Type: application/json' \ --data-raw '{ "some":"content" }'

That's where things go very wrong.

Unable to load shared library 'winspool.Drv' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libwinspool.Drv: cannot open shared object file: No such file or directory

Go figure, running the service in a Docker container in the WSL2 engine doesn't give us acccess to winspool.drv, whodathunkit.

After looking around for a bit, I found some Microsoft documentation that looked appropriate... except it doesn't work.

docker run -it --isolation hyperv mcr.microsoft.com/dotnet/aspnet:3.1 powershell.exe docker: Error response from daemon: Invalid isolation: "hyperv" - linux only supports 'default'.

The Docker Desktop system apparently runs by default on WSL2 and that's incomaptible with the article. Worse, when I tried to switch to a Hyper-V backed version (in the settings), Docker told me it's a legacy version, then proceeded to crash, refusing to work again until I rebooted the Windows host and switched back to the WSL2 version.

Am I dead in the water or is there a solution?

0 Answers
Related