0

I've an asp.net core app that I want to run as windows container inside Azure app service. The app uses PowerShell 5.1 and I'm not using mcr.microsoft.com/dotnet/aspnet:6.0, but building it as self contained. Snippets of the docker file are:

FROM mcr.microsoft.com/windows/servercore:ltsc2019 AS base
....
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
.. -c Release -o /app/publish --self-contained --runtime win-x64
...
and then
FROM base AS final
ENTRYPOINT ["App.exe"]

The docker file is used to correctly build and push to ACR from azure devops pipeline, but when running the image in App Service it says: Unable to start container. Error message: Index was outside the bounds of the array

I've also tried couple of other base images: FROM mcr.microsoft.com/dotnet/aspnet:6.0-windowsservercore-ltsc2019 AS base and FROM mcr.microsoft.com/dotnet/runtime:5.0-windowsservercore-ltsc2019 AS base and they give same error. I suspect it's because the image is not supported in app service. Running locally on Windows 10 laptop is fine. Does anyone know what windows images does app service support?

pevgeniev
  • 389
  • 2
  • 13
  • Please refer similar issue in [MS Q&A](https://learn.microsoft.com/en-us/answers/questions/463587/windows-containers-unable-to-start-container-error.html) once. – Harshitha Veeramalla Jan 29 '22 at 08:22
  • I've seen it and as I said trying with image mcr.microsoft.com/dotnet/runtime:5.0-windowsservercore-ltsc2019 gave the same error. – pevgeniev Jan 29 '22 at 08:56

1 Answers1

0

When we are creating an App service its create an image itself which is auto generated enter image description here

If you want to configure custom image please refer this Microsoft Documentation:Configure a custom container for Azure App Service

As its failing while start the App service in windows container please check your console logs by Go to Advance Tools > Kudu console

For more information please refer the below links

MS Q&A:- Diagnose container start issues in Azure App Service for Linux & Azure App Service using a Windows container Failing and restarting

AjayKumarGhose
  • 4,257
  • 2
  • 4
  • 15
  • I couldn't get it to run in Azure App Service. I tried with selecting Image Source: Azure Container Registry, then picking up my custom image, but then when running the App Service it again shows an error : 'Unable to start container. Error message: Index was outside the bounds of the array'. But I did managed to run it in Azure Container Instances, with exactly the same steps in the Docker configuration, so not sure why it doesn't run in App service – pevgeniev Feb 03 '22 at 15:52