Azure Function with Docker not showing in list / running properly

Banias Baabe 0 Reputation points
2024-09-06T10:24:20.1533333+00:00

I have created an Azure Function with the following Docker Image:

FROM mcr.microsoft.com/azure-functions/python:4-python3.11

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \

 AzureFunctionsJobHost__Logging__Console__IsEnabled=true

COPY requirements.txt /

RUN pip install -r /requirements.txt

COPY . /home/site/wwwroot

My Container Logs show the following:

2024-09-06T10:13:33.629Z INFO - Container dev-confluence-connector_1_d2f0bfc7_msiProxy for site dev-confluence-connector initialized successfully and is ready to serve requests. 2024-09-06T10:13:33.629Z INFO - Initiating warmup request to container dev-confluence-connector_1_d2f0bfc7 for site dev-confluence-connector 2024-09-06T10:13:42.225Z INFO - Container dev-confluence-connector_1_d2f0bfc7 for site dev-confluence-connector initialized successfully and is ready to serve requests.

But my Function is not listed:

User's image

In the "App Files" Tab, I can see that all my files are correctly added.

This is my file structure:


├── Dockerfile

├── Makefile

├── README.md

├── confluence_synchronisation (here are my python scripts)

├── function_app.py

├── host.json

├── poetry.lock

├── pyproject.toml

├── requirements.txt

host.json:


{

 "version": "2.0",

 "logging": {

 "applicationInsights": {

 "samplingSettings": {

 "isEnabled": true,

 "excludedTypes": "Request"

 }

 }

 },

 "extensionBundle": {

 "id": "Microsoft.Azure.Functions.ExtensionBundle",

 "version": "[4.*, 5.0.0)"

 },

 "functionTimeout": "23:00:00"

}

Environment Variables in Azure Portal:


[

 {

 "name": "AzureWebJobsDashboard",

 "value": "DefaultEndpointsProtocol=https;AccountName=devstgconfluenceconn;AccountKey=****==;EndpointSuffix=core.windows.net",

 "slotSetting": false

 },

 {

 "name": "AzureWebJobsStorage",

 "value": "DefaultEndpointsProtocol=https;AccountName=devstgconfluenceconn;AccountKey=****==;EndpointSuffix=core.windows.net",

 "slotSetting": false

 },

 {

 "name": "DOCKER_REGISTRY_SERVER_PASSWORD",

 "value": "******",

 "slotSetting": false

 },

 {

 "name": "DOCKER_REGISTRY_SERVER_URL",

 "value": "https://******.azurecr.io",

 "slotSetting": false

 },

 {

 "name": "DOCKER_REGISTRY_SERVER_USERNAME",

 "value": "***",

 "slotSetting": false

 },

 {

 "name": "FUNCTIONS_EXTENSION_VERSION",

 "value": "~4",

 "slotSetting": false

 },

 {

 "name": "WEBSITE_RUN_FROM_PACKAGE",

 "value": "1",

 "slotSetting": false

 },

 {

 "name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE",

 "value": "false",

 "slotSetting": false

 }

]
Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
446 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,907 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Srinud 2,310 Reputation points Microsoft Vendor
    2024-09-06T18:44:43.1033333+00:00

    Hi Banias Baabe,
    Thank you for reaching out to us on the Microsoft Q&A forum.

    The Dockerfile you provided is missing the EXPOSE and CMD instructions, which are essential for building the Docker image. Please add these instructions to the Dockerfile. After updating it, build the Docker image, deploy the container to run the Azure Function, and verify that it’s running correctly.

    If you are still facing any issue, please let us know in the comments. We are glad to help you.

    If this information is helpful, we would appreciate it if you could click the Accept Answer & Upvote on this post.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.