An Azure service that provides an event-driven serverless compute platform.
Hi Maria,
Thx for posting your question here at Q&A portal. The problem you're experiencing is that while you've added AzureWebJobsStorage to local.settings.json and removed it from .dockerignore, the Azure Functions runtime in the container isn't picking up these settings. Some issues in your current setup:
local.settings.json isn't automatically loaded in containers, this file is only used by the Functions Core Tools (func host start), not by the container runtime. Missing WORKER_RUNTIME setting - Python functions require this environment variable. Potential pip install issue - your run pip install requirements.txt should be RUN pip install -r requirements.txt ....
FROM mcr.microsoft.com/azure-functions/python:4-python3.12
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true \
PYTHON_ISOLATE_WORKER_DEPENDENCIES=1 \
FUNCTIONS_WORKER_RUNTIME=python \
AzureWebJobsStorage="DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;QueueEndpoint=http://azurite:10001/devstoreaccount1;TableEndpoint=http://azurite:10002/devstoreaccount1;"
COPY requirements.txt /
RUN pip install -r requirements.txt
COPY . /home/site/wwwroot
I would like to post some recommendations for local development if you like.
Use Azurite for local storage
docker run -d -p 10000:10000 -p 10001:10001 -p 10002:10002 --name azurite mcr.microsoft.com/azure-storage/azurite
Build and run your function with networking
docker build -t mypythonfunction .
docker run -p 8080:80 --link azurite -e AzureWebJobsStorage="UseDevelopmentStorage=true" mypythonfunction
The UseDevelopmentStorage=true setting only works when your function can connect to Azurite on the default ports. For production deployments, you'll need to provide a real storage account connection string. Make sure your requirements.txt file includes azure-functions package. Hope that would help.
rgds, Alex
P.s. If my answer help to you, please Accept my answer