I am trying to migrate several of our dotnet based function-apps (v3) to docker containers. For this we use images from mcr.microsoft.com/azure-functions/dotnet as a base
When testing locally using docker run, I often have the problem a http call to the container returns error Function host is not running
combined with the following Docker CLI output:
Starting OpenBSD Secure Shell server: sshd.
Hosting environment: Development
Content root path: /home/site/wwwroot
Now listening on: http://[::]:80
Application started. Press Ctrl+C to shut down.
This simply means the function app won't load / start but the real cause stays hidden. I have been trying to get more logging/ diagnostics data to determine the underlying cause but failed so far. As a result, I have to start an exhausting trial-and-error test loop, everytime this situation occurs. These situations have taken me several days (weeks?) so far
Question: How do I get more diagnostic data when this error occurs?
[UPDATE] the Dockerfile:
FROM mcr.microsoft.com/azure-functions/dotnet:3.0-appservice AS base
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:3.1-buster AS build
WORKDIR /src
# provide access to private nuget (source)
ARG FEED_SOURCE
ARG FEED_ACCESSTOKEN
RUN dotnet new nugetconfig
RUN dotnet nuget add source %FEED_SOURCE% -n PrivateFeed -u docker -p %FEED_ACCESSTOKEN% --store-password-in-clear-text --configfile nuget.config
# Restore all nuget packages by the related .csproj files
COPY ["MyCompany.MyApp.FunctionApp/MyCompany.MyApp.FunctionApp.csproj", "MyCompany.MyApp.FunctionApp/"]
RUN dotnet restore "MyCompany.MyApp.FunctionApp/MyCompany.MyApp.FunctionApp.csproj"
# Copy the rest of the project-folder's content
COPY ["MyCompany.MyApp.FunctionApp", "MyCompany.MyApp.FunctionApp"]
# build the app project
WORKDIR "/src/MyCompany.MyApp.FunctionApp"
RUN dotnet build -c Release --no-restore
FROM build AS publish
RUN dotnet publish -c Release --no-build -o /app/publish
FROM base AS final
WORKDIR /home/site/wwwroot
COPY --from=publish /app/publish .
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AZUREFUNCTIONSJOBHOST__LOGGING__CONSOLE__ISENABLED=true