0

I'm trying to get a very simple .net core console app to run in a windows container on Azure Container Instances but I'm having soo many problems.

First I attempted using the microsoft/dotnet:2.1-runtime as the base image but I can the error regarding the wrong windows version which has been reported at Azure Container Instance Windows Version Wrong. I've tried numerous different base images, some which run on my local machine and some that don't but I still can't find a base image which has dot net core on it and is a valid windows version for the ACI service. Can anyone point me in the direction of what base image I should be using? Or have I got completely the wrong end of the stick? TIA

FROM microsoft/dotnet:2.2-runtime AS base 
WORKDIR /app 

FROM microsoft/dotnet:2.2-sdk AS build 
WORKDIR /src 
COPY [<obfuscated>.csproj", "<obfuscated>./"] 
RUN dotnet restore "<obfuscated>.csproj" 
COPY . . 
WORKDIR "/src/<obfuscated>." 
RUN dotnet build "<obfuscated>.csproj" -c Release -o /app 

FROM build AS publish 
RUN dotnet publish "<obfuscated>..csproj" -c Release -o /app 
FROM base AS final WORKDIR /app 
COPY --from=publish /app . 
ENTRYPOINT ["dotnet", "<obfuscated>.dll"]
Ross Ellerington
  • 149
  • 1
  • 12
  • Where are you building the .net project? – Van_Cleff Mar 14 '19 at 09:28
  • On my machine which is Windows 10. Does that make a difference? – Ross Ellerington Mar 14 '19 at 09:30
  • could you share the docker file in your question? Yes it makes a difference if the SDK and runtime versions mismatch you may hit this issue. Please, update your question with `Dockerfile` – Van_Cleff Mar 14 '19 at 09:31
  • ```FROM microsoft/dotnet:2.2-runtime AS base WORKDIR /app FROM microsoft/dotnet:2.2-sdk AS build WORKDIR /src COPY [.csproj", "./"] RUN dotnet restore ".csproj" COPY . . WORKDIR "/src/." RUN dotnet build ".csproj" -c Release -o /app FROM build AS publish RUN dotnet publish "..csproj" -c Release -o /app FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", ".dll"]``` – Ross Ellerington Mar 14 '19 at 09:41
  • I don't seem to be able to edit the question so I've copied it as a comment. Annoyingly it's lost the formatting, but hopefully you get the gist ;) – Ross Ellerington Mar 14 '19 at 09:41
  • 1
    use this as base image `microsoft/dotnet:2.2-aspnetcore-runtime` and update it it worked. – Van_Cleff Mar 14 '19 at 09:59
  • Didn't work. I still get this error: ```{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.","details":[{"code":"BadRequest","message":"{\r\n \"error\": {\r\n \"code\": \"OsVersionNotSupported\",\r\n \"message\": \"The Windows version of image 'efpsdocker.azurecr.io/dockertest:v1' is not supported. The supported Windows versions are: '10.0.14393'.\"\r\n }\r\n}"}]}``` – Ross Ellerington Mar 14 '19 at 10:20
  • 1
    ok try this one `microsoft/windowsservercore` sorry it;'s a hit and trial issue can't do much. This sh** is not documented anywhere. :( – Van_Cleff Mar 14 '19 at 10:38
  • Yes, that's my frustration with this. I don't get why I'm just using Microsoft technologies but none of them work together. I'm attempting to deploy using a non docker solution at the moment but if i get no joy I'll try out that image. Thanks for you help though ;) – Ross Ellerington Mar 14 '19 at 10:40

0 Answers0