Reputation: 2896
I am trying to deploy a containerised ASP.NET Core 3.1 application into Azure Azure Container Instances (ACI).
The app is a freshly created Visual Studio 2019 Asp.NET Core Web App with Docker support. It builds and runs fine locally.
Publishing in an Azure Container Registry (ACR) using the publish wizard in Visual Studio 2019 succeeds as well.
The issue comes when I try to spin up a container into Azure Container Instance with that image (through the portal). This fails with the following error:
{
"code":"DeploymentFailed",
"message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
"details":[{
"code":"BadRequest",
"message":"{
\"error\": {
\"code\": \"UnsupportedWindo wsVersion\",
\"message\": \"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'\"
}
}"
}]}
Below the DOCKERFILE (untouched from the Visual studio template)
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1903 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1903 AS build
WORKDIR /src
COPY ["WebApplication2/WebApplication2.csproj", "WebApplication2/"]
RUN dotnet restore "WebApplication2/WebApplication2.csproj"
COPY . .
WORKDIR "/src/WebApplication2"
RUN dotnet build "WebApplication2.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "WebApplication2.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApplication2.dll"]
I would expect that being a brand new Visual Studio application, I shouldn't need to make any changes to have it working, but doesn't seem so. What should I do to fix this?
UPDATE 1:
Changed DOCKERFILE 1903 -> 1909
docker inspect on image:
"Os": "windows",
"OsVersion": "10.0.18363.959",
Outcome: no changes, same identical error message
UPDATE 2:
Changed DOCKERFILE 1903 -> 2004
Outcome: Visual Studio fails to build-start (F5) the project with the following error:
Error CTC1014 Docker command failed with exit code 1. a Windows version 10.0.19041-based image is incompatible with a 10.0.18363 host WebApplication2 C:\temp\WebApplication2\WebApplication2\Dockerfile 1
new DOCKERFILE:
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-2004 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-2004 AS build
WORKDIR /src
COPY ["WebApplication2/WebApplication2.csproj", "WebApplication2/"]
RUN dotnet restore "WebApplication2/WebApplication2.csproj"
COPY . .
WORKDIR "/src/WebApplication2"
RUN dotnet build "WebApplication2.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "WebApplication2.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApplication2.dll"]
Upvotes: 4
Views: 577
Reputation: 1587
It is happy with "before 2B" and "after 2B" but not "2B". Per MS there was a breaking change in an image (2B) that was later fixed.
Is it possible that you already pulled this image in early February? If so then you might be publishing that broken version. Try running docker inspect <image_id>
and see if the OS Version is at least "10.0.18362.719". If not, you could remove that image and pull a new copy.
Or, you could change both "1903"s to "1909" or "2004" in the Dockerfile and try and get a newer version of nanoserver that is post-"2B".
Upvotes: 1