skip to Main Content

I’m trying to deploy a windows container that holds a simple ASP.NET Core Web App to an azure web app. I’ve created a container registry, and pushed my docker image to it. However, every time I try to create a web app that uses the docker image, it fails to deploy with

enter image description here

enter image description here

I’m absolutely certain it’s not an issue with my docker image. I’ve deployed it from visual studio, visual studio code, and the command line. All of my files are the standard inputs from creating a ASP.NET Core Web App (Razor Pages) project in visual stuido. Here are my settings for the [web app settings]

enter image description here

when I’m creating the [app service plan]

enter image description here

and when I’m configuring the [azure container registry]

enter image description here

I’m really not sure what the issue could be anymore. I’ve tried switching pricing plans, locations, recreating the project from the group up, deploying new resources. I tried a container app but that failed because I’m using docker-windows images no Linux. Azure says windows containers are supported but at this point I’m not sure.

I’m new to docker an have only been working with azure for a couple months so it’s possible I missed some crucial step somewhere, but I’ve been following simple documentation and it’s still failing.

I’m really stumped here, if anyone could offer any guidance that would be great.

EDIT:
I tried creating a new resource group, same format didn’t change anything with the error. The only thing in the resource group is the ACR and the web app, the resource group is located in East US. Swithcing pricing plans for the web app gave me a new error however:

(Code: ValidationForResourceFailed)
This region has quota of 0 PremiumMV3 instances for your subscription. Try selecting different region or SKU. (Code: SubscriptionIsOverQuotaForSku)

The monthly cost for this app would be over my student-subscription-credit-limit, but I wouldn’t have it up that long as this is a demo app. It might be a limit of the student subscription, also with the IT crisis happening this could just be a byproduct, although this issue has persisted sience wednesday 7/17/2024

Here is my dockerfile as requested:

`FROM mcr.microsoft.com/dotnet/aspnet:8.0-nanoserver-1809 AS base
WORKDIR /app
EXPOSE 3000

FROM mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-1809 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["container-app.csproj", "."]
RUN dotnet restore "./container-app.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "./container-app.csproj" -c %BUILD_CONFIGURATION% -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./container-app.csproj" -c %BUILD_CONFIGURATION% -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "container-app.dll"]`

2

Answers


  1. Chosen as BEST ANSWER

    In the end, I determined that it must be a limitation of my subscription or Azure web apps that use Windows containers that were causing the error. I switched to Linux containers and followed the steps listed in @Sirra Sneha's answer and that worked to deploy my web app.

    I'm still not sure which it is, as I can't find any documentation that says I'm unable to deploy Windows container web apps through a student subscription. I also couldn't create premium web apps (also likely due to my subscription) so if you're struggling to deploy Windows containers maybe try using a premium app service plan instead of a free tier.


  2. I created a simple ASP .NET Core application and deployed it to Azure App Service (Windows) Via Azure Container registry.

    The error message you’re encountering says Windows containers are not allowed in the resource group. Try creating a new resource group and deploying the app again.

    • Right click on your project in solution explorer => Add => Docker support => Make sure you select Target OS as windows.

    enter image description here

    enter image description here

    I successfully pushed the image to container registry.

    • Right click on your project in solution explorer=>publish=>Azure => Azure container registry =>select your registry => Finish.

    enter image description here

    enter image description here

    enter image description here

    enter image description here

    • When creating the Azure Web App, choose the "Container" publish option.

    • Make sure the App Service is set to use the correct container image from your Azure Container Registry (ACR).

    enter image description here

    enter image description here

    Here’s the output Deployment:

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search