I have an azure function, I am using azure container registry image for the deployment but getting Azure runtime is unreachable. I have checked the docker logs from Kudu, it is throwing –
Pull Image successful, Time taken: 0 Minutes and 1 Seconds
2022-12-13T07:40:49.911Z INFO – Starting container for site
2022-12-13T07:40:49.912Z INFO – docker run -d –expose=80 –name <function_app>_0_e2779bae -e DOCKER_CUSTOM_IMAGE_NAME=/: -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITE_SITE_NAME=<function_app> -e WEBSITE_AUTH_ENABLED=False -e PORT=80 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=<function_app>.azurewebsites.net -e WEBSITE_INSTANCE_ID= -e WEBSITE_USE_DIAGNOSTIC_SERVER=False <image_path>
2022-12-13T07:40:49.913Z INFO – Logging is not enabled for this container.
Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2022-12-13T07:40:50.683Z INFO – Initiating warmup request to container <function_app>_0_e2779bae_msiProxy for site <function_app>
2022-12-13T07:40:50.692Z INFO – Container <function_app>_0_e2779bae_msiProxy for site <function_app> initialized successfully and is ready to serve requests.
2022-12-13T07:40:50.693Z INFO – Initiating warmup request to container <function_app>_0_e2779bae for site <function_app>
2022-12-13T07:40:50.706Z ERROR – Container <function_app>_0_e2779bae for site <function_app> has exited, failing site start
2022-12-13T07:40:50.712Z ERROR – Container <function_app>_0_e2779bae didn’t respond to HTTP pings on port: 80, failing site start. See container logs for debugging.
2022-12-13T07:40:50.718Z INFO – Stopping site <function_app> because it failed during startup.
I have added docker url, username and password attributes in the app-settings and are correct. Can someone please help me out with the same?
2
Answers
I have tried several ways but got to know the reason at last.
The issue was with the dockerfile, but the error logs were not showing the actual cause.
Previously in the dockerfile we were using entrypoint and the code was not getting published to wwwroot
WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "someapplication.dll"]
and then we modified the file to publish it to wwwroot
WORKDIR /home/site/wwwroot COPY --from=publish /app/publish . ENV AzureWebJobsScriptRoot=/home/site/wwwroot
This resolved my problem.
There could be several reasons for the above error such as:
8080
or80
by adding the app setting asWEBSITES_PORT
.Refer to this MS Q&A Issue No 750525 regarding the similar error on Azure Functions Container Context and also many similar issues reported on GitHub Repositories such as 46401, 34451 for the solutions given by MSFT Azure Team.