Why does .NET Framework sample image throw error when running in Azure Container Instances from Azure Container Registry?

  .net, acr, azure-container-instances, docker

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.

Source: Docker Questions

LEAVE A COMMENT