question

ronkit-5872 avatar image
0 Votes"
ronkit-5872 asked ronkit-5872 commented

Azure App Service Window Container Fail to start (.Net Core Sdk not found)

Created ASP .net Core Web Api project using Visual Studio 2022 with docker support for Windows.
Below was my docker file. It was auto generated when I enable docker support for Windows

 FROM mcr.microsoft.com/dotnet/aspnet:3.1-nanoserver-1809 AS base
 WORKDIR /app
 EXPOSE 80
 EXPOSE 443
    
 FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
 WORKDIR /src
 COPY ["TestDocker/TestDocker.csproj", "TestDocker/"]
 RUN dotnet restore "TestDocker/TestDocker.csproj"
 COPY . .
 WORKDIR "/src/TestDocker"
 RUN dotnet build "TestDocker.csproj" -c Release -o /app/build
    
 FROM build AS publish
 RUN dotnet publish "TestDocker.csproj" -c Release -o /app/publish
    
 FROM base AS final
 WORKDIR /app
 COPY --from=publish /app/publish .
 ENTRYPOINT ["dotnet", "TestDocker.dll"]

After deployed to Azure App Service Window container, it keep showing me unable to start the container.
After checking from App Service Kudu, found these error message in console logs:

 24/05/2022 16:39:32.107 STDERR - Site: simpleDocker123 - [c67b2a5f07c12c44b98311303842a244ec416eea0432e0f0fcbe9218dc1be242] -       https://aka.ms/dotnet-download
 24/05/2022 16:40:05.113 STDERR - Site: simpleDocker123 - [aa0bab045680844de048b1f7c158f88d53585d531484bb3f1030800731b56ecb] -   It was not possible to find any installed .NET Core SDKs
 24/05/2022 16:40:05.113 STDERR - Site: simpleDocker123 - [aa0bab045680844de048b1f7c158f88d53585d531484bb3f1030800731b56ecb] -   Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
 24/05/2022 16:40:05.113 STDERR - Site: simpleDocker123 - [aa0bab045680844de048b1f7c158f88d53585d531484bb3f1030800731b56ecb] -       https://aka.ms/dotnet-download
 24/05/2022 16:42:51.232 STDERR - Site: simpleDocker123 - [29a2d2d08e27bb6852608a4b2ac116a55bf011c19bdfc4278e069aa368d76c66] -   It was not possible to find any installed .NET Core SDKs
 24/05/2022 16:42:51.232 STDERR - Site: simpleDocker123 - [29a2d2d08e27bb6852608a4b2ac116a55bf011c19bdfc4278e069aa368d76c66] -   Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
 24/05/2022 16:42:51.232 STDERR - Site: simpleDocker123 - [29a2d2d08e27bb6852608a4b2ac116a55bf011c19bdfc4278e069aa368d76c66] -       https://aka.ms/dotnet-download

On platform logs was something as below:

 24/05/2022 16:51:39.528 INFO - Site: simpleDocker123 - [e30858fffca0b25a8280722958eb413a87299c1422cf713f786e8ae839a5091a] - Start container succeeded.
 24/05/2022 16:51:45.822 INFO - Site: simpleDocker123 - [e30858fffca0b25a8280722958eb413a87299c1422cf713f786e8ae839a5091a] - Container has started.
 24/05/2022 16:51:45.822 INFO - Site: simpleDocker123 - [e30858fffca0b25a8280722958eb413a87299c1422cf713f786e8ae839a5091a] - Customizing the container
 24/05/2022 16:51:47.053 INFO - Site: simpleDocker123 - [e30858fffca0b25a8280722958eb413a87299c1422cf713f786e8ae839a5091a] - Container customization has completed successfully
 24/05/2022 16:51:47.067 INFO - Site: simpleDocker123 - [e30858fffca0b25a8280722958eb413a87299c1422cf713f786e8ae839a5091a] - Container has started.
 24/05/2022 16:51:47.836 INFO - Site: simpleDocker123 - [e30858fffca0b25a8280722958eb413a87299c1422cf713f786e8ae839a5091a] - Container entrypoint has started
 24/05/2022 16:52:08.890 ERROR - Site: simpleDocker123 - [e30858fffca0b25a8280722958eb413a87299c1422cf713f786e8ae839a5091a] - Container entrypoint is no longer running.
 24/05/2022 16:52:08.890 ERROR - Site: simpleDocker123 - [e30858fffca0b25a8280722958eb413a87299c1422cf713f786e8ae839a5091a] - Container was not ready because it has been cancelled or exited
 24/05/2022 16:52:08.890 INFO - Site: simpleDocker123 - [e30858fffca0b25a8280722958eb413a87299c1422cf713f786e8ae839a5091a] - Attempting to stop container: e30858fffca0b25a8280722958eb413a87299c1422cf713f786e8ae839a5091a. Site simpleDocker123
 24/05/2022 16:52:08.947 INFO - Site: simpleDocker123 - [e30858fffca0b25a8280722958eb413a87299c1422cf713f786e8ae839a5091a] - Shutdown container: e30858fffca0b25a8280722958eb413a87299c1422cf713f786e8ae839a5091a

Any idea on this issue? Already followed the guide from microsoft exactly but still hitting these error
Any help will be appreciate

Thanks





dotnet-csharpdotnet-aspnet-core-webapidotnet-ad
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JasonPan-MSFT avatar image
0 Votes"
JasonPan-MSFT answered ronkit-5872 commented

Hi @ronkit-5872

Change your docker file like below, keeping your runtime and sdk version consistent should solve this problem.

  FROM mcr.microsoft.com/dotnet/aspnet:3.1-nanoserver-1809 AS base
  WORKDIR /app
  EXPOSE 80
  EXPOSE 443
        
  FROM mcr.microsoft.com/dotnet/sdk:3.1-nanoserver-1809 AS build
  WORKDIR /src
  COPY ["TestDocker/TestDocker.csproj", "TestDocker/"]
  RUN dotnet restore "TestDocker/TestDocker.csproj"
  COPY . .
  WORKDIR "/src/TestDocker"
  RUN dotnet build "TestDocker.csproj" -c Release -o /app/build
        
  FROM build AS publish
  RUN dotnet publish "TestDocker.csproj" -c Release -o /app/publish
        
  FROM base AS final
  WORKDIR /app
  COPY --from=publish /app/publish .
  ENTRYPOINT ["dotnet", "TestDocker.dll"]



If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Best Regards,
Jason



· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@JasonPan-MSFT Hi jason, im still getting the same error after changing the docker file. Still unable to start the container right

0 Votes 0 ·

Hi @ronkit-5872

Can you temporarily create a new container webapp for testing? Because I want to rule out that your current webapp may not be able to run due to special factors, I want to make sure that your program can be successfully launched in the new webapp. Please delete it as soon as the test is complete.

0 Votes 0 ·

Hi @JasonPan-MSFT Yes, was testing using a whole new App Service Window container plan. Tried also using the default docker file generated by Visual Studio 2022 cant start the container too

0 Votes 0 ·
Show more comments