Docker image fails to start on single container instance but works fine on DockerHub

Docker image fails to start on single container instance but works fine on DockerHub

Our project has a docker image built on Windows that is pushed to azure container registry and DockerHub.

There are two app services – one refers to container image from DockerHub (public repo) and the other one referring the same image from ACR – Single Container Instance.

The one deployed from DockerHub starts and runs without any error message whereas the one deployed to Single Container Instance throws the following error in the logs:

1/07/2019 23:36:51.227 INFO - Site: mycontainer - Start container succeeded. Container: 
11/07/2019 23:36:56.245 INFO - Site: mycontainer - Container has exited
11/07/2019 23:36:56.261 INFO - Site: mycontainer - Purging pending logs after stopping container
11/07/2019 23:36:56.245 ERROR - Site: mycontainer - Container could not be started
11/07/2019 23:36:56.245 INFO - Site: mycontainer - Attempting to stop container: 196bc2a89fb093415220b659c1eda7fabaaeebd97a2e71802e1dce592defcb35
11/07/2019 23:36:56.261 INFO - Site: mycontainer - Container stopped successfully. Container Id: 196bc2a89fb093415220b659c1eda7fabaaeebd97a2e71802e1dce592defcb35
11/07/2019 23:36:56.274 INFO - Site: mycontainer - Purging after container failed to start
  1. I have tried publishing the container project as a self-contained application with runtimeconfig.json which still does not make the container work on a ACR – single container instance.
  2. I have verified that the image size is around 350+ MB and there is enough quota on the app service.
  3. I have compared the configuration of both the app services and they are exactly the same except one has sourced from DockerHub and the other one (the problematic one) has sourced from Azure Container registry.

My Docker file content

FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-nanoserver-1809 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:3.0-nanoserver-1809 AS build
WORKDIR /src
COPY ["ProjectFolder/ContainerProject.csproj", "ProjectFolder/"]
RUN dotnet restore ProjectFolder/ContainerProject.csproj
COPY . .
WORKDIR "/src/ProjectFolder"
RUN dotnet build "ContainerProject.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "ContainerProject.csproj" -c Release -o

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

As “Diagnose and Solve Problems” option is not available for Windows containers, please help if anybody has faced similar situation and if there are any fixes/ troubleshooting steps.

Thank you!

Source: StackOverflow