Running linux function app with docker

Jon Langlois 21 Reputation points


I am a bit stuck following a guide to deploy a linux function app using a docker image. I have followed this guide:

So far, I have built a docker image and everything works fine locally, I can hit the /api/httpexample route. When deployed on the cloud, the docker container pulls and starts okay, from the function app logs I get:

2022-08-31T22:45:10.160Z INFO - Initiating warmup request to container pineapple-function-app_8_b8358460 for site pineapple-function-app
2022-08-31T22:45:11.085Z INFO - Container pineapple-function-app_8_b8358460 for site pineapple-function-app initialized successfully and is ready to serve requests.

However, when I try to hit the same API route I get a 404 (The default landing page shows up fine).

So far I have tried running the same docker run ... command I saw in the cloud logs locally to see if it would work. The one difference is I have to add the flag -p 80:80 to make the command from the cloud logs work on my local machine. I haven't been able to find any configuration to affect that though beyond changing the environment settings WEBSITES_PORT and PORT, that didn't add a -p flag to the command though.

I am a bit stuck on what to try to debug this, any help would be greatly appreciated.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,207 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jon Langlois 21 Reputation points

    Just following up, I figured out my issue.

    When following the tutorial, I was trying to use terraform to provision the resources instead of the az cli, with the azurerm_linux_function_app resource for the function app. The storage account, service plan and function app were all created correctly, but the function app itself was missing the application setting WEBSITES_ENABLE_APP_SERVICE_STORAGE, which gets adding when making it through the cli. Adding this with the value false fixed the 404 issue that I was getting.

    Hope this can help someone in the future

    0 comments No comments