Reputation: 6006
I have a function app and am planning to use Azure KEDA for deployment. When converting the current function app to docker and testing the same in local using the docker run command
, I get the below error.
Function host is not running.
It works while debugging in visual studio, but does not work in Docker. Other stackoverflow answers suggest check host.json and i tried it, but did not fix it.
Below is my host.json.
{
"version": "2.0",
"logging": {
"fileLoggingMode": "always",
"logLevel": {
"default": "Information",
"Host": "Error",
"Function": "Error",
"Host.Aggregator": "Information"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"maxTelemetryItemsPerSecond": 20
}
}
}
}
DockerFile
FROM microsoft/dotnet:2.2-sdk AS installer-env
COPY . /src/dotnet-function-app
RUN cd /src/dotnet-function-app && \
mkdir -p /home/site/wwwroot && \
dotnet publish Projects/Projectxxx.csproj --output /home/site/wwwroot
# To enable ssh & remote debugging on app service change the base image to the one below
# FROM mcr.microsoft.com/azure-functions/dotnet:2.0-appservice
FROM mcr.microsoft.com/azure-functions/dotnet:2.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]
Upvotes: 2
Views: 2613
Reputation: 6006
I did two things to make it work.
<PackageReference Include="WindowsAzure.Storage" Version="9.3.2" />
to .csprojdocker run -e
environment parameters, which was used in startup.csUpvotes: 1