I'd like to run a .NET Framework (4.8) console app on Azure Container Instances.
Starting from https://github.com/microsoft/dotnet-framework-docker/tree/master/samples/dotnetapp
If I create the ACI directly:
az container create --resource-group mygroup --name nethowdy --image mcr.microsoft.com/dotnet/framework/samples:dotnetapp --restart-policy Never --os-type Windows
... it runs as expected - i.e., it completes successfully, and the output is correct:
az container logs --resource-group mygroup --name nethowdy
So far, so good.
Then I cloned https://github.com/microsoft/dotnet-framework-docker and went to the samples/dotnetapp folder. Works fine building/running docker locally.
However, when I try to build that sample image into ACR, I can't get it to work. Specifically, I do this:
az acr build --registry myreg --image nethowdy --file Dockerfile.basic --platform windows .
That build process succeeds, and everything looks good. But when I try to create the container from it, it fails:
az container create --resource-group mygroup --name nethowdy --image myreg.azurecr.io/nethowdy --restart-policy Never --os-type Windows
Specifically, I get this error:
BadRequestError: Unsupported windows image version. Supported versions are 'Windows Server 2016 - Before 2B, Windows Server 2019 - Before 2B, Windows Server 2016 - After 2B, Windows Server 2019 - After 2B'
Can anyone tell me what I'm doing wrong? This is the base .NET Framework image, so it should be able to run on ACI - and it clearly does when I create the container from Microsoft's image instead of mine. Is this an auth problem with ACI/ACR or something like that? I'd appreciate any clues.
EDIT: I've moved past the obstacle, so I'm not stuck - but I'm still figuring out details of "the problem" ... I'll post my own answer soon to help the next person
The error already shows you the reason: unsupported Windows image version. ACI does not support all the windows images, you can get the details here about the windows image that supported in the ACI.