I want to create function app using docker image.

Gaurav 0 Reputation points
2025-12-19T11:56:28.61+00:00

I have already created function app with flex consumption plan. I want to deploy the code using docker image. What is the right procedure?

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

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-12-19T11:56:39.9633333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To deploy your Azure Function App using a Docker image, follow these steps:

    1. Update the Image: If you have made changes to your function code or need to update the base image, rebuild your Docker image locally. Use the following command to build your image:
         docker build --tag <DOCKER_ID>/<IMAGE_NAME>:v1.0.0 .
      
      Replace <DOCKER_ID> and <IMAGE_NAME> with your Docker Hub account ID and desired image name, respectively.
    2. Push the Image to a Registry: After building the image, push it to your container registry (either Docker Hub or Azure Container Registry). For Docker Hub, use:
         docker push <DOCKER_ID>/<IMAGE_NAME>:v1.0.0
      
      For Azure Container Registry, use:
         az acr build --registry <REGISTRY_NAME> --image <LOGIN_SERVER>/azurefunctionsimage:v1.0.1 .
      
      Replace <REGISTRY_NAME> and <LOGIN_SERVER> with your Azure Container Registry details.
    3. Update the Function App Configuration: Use the Azure CLI or Azure portal to update your function app to use the new Docker image. The command for Azure CLI is:
         az functionapp config container set --image <IMAGE_NAME> --registry-password <SECURE_PASSWORD> --registry-username <USER_NAME> --name <APP_NAME> --resource-group <RESOURCE_GROUP>
      
      Replace <IMAGE_NAME>, <SECURE_PASSWORD>, <USER_NAME>, <APP_NAME>, and <RESOURCE_GROUP> with your specific details.
    4. Verify Deployment: After updating the configuration, verify that your function app is running the new Docker image. You can check the Azure portal for the status of your function app.

    By following these steps, you should be able to successfully deploy your function app using a Docker image.

    0 comments No comments

  2. Pravallika KV 4,195 Reputation points Microsoft External Staff Moderator
    2025-12-19T18:44:38.79+00:00

    Hi Gaurav,

    Thanks for reaching out to Microsoft Q&A.

    Steps to deploy your code using a Docker image:

    1. Create a Docker Image:

    First, ensure you have a Dockerfile in your local project. You can build your Docker image using the following command:

    docker build --tag <DOCKER_ID>/<IMAGE_NAME>:v1.0.0 .
    

    Replace <DOCKER_ID> and <IMAGE_NAME> with your Docker Hub account ID and the desired image name.

    1. Push to Container Registry:

    After building your Docker image, push it to a container registry. If you're using Azure Container Registry, you can use:

    az acr build --registry <REGISTRY_NAME> --image <LOGIN_SERVER>/azurefunctionsimage:v1.0.1 .
    

    For Docker Hub, you can use:

    docker push <DOCKER_ID>/azurefunctionsimage:v1.0.1
    
    1. Update Function App to Use the New Image:

    You can set your Function App to use the new Docker image either through the Azure CLI or in the Azure portal. Using the Azure CLI, the command looks like this:

    az functionapp config container set --image <IMAGE_NAME> --registry-password <SECURE_PASSWORD> --registry-username <USER_NAME> --name <APP_NAME> --resource-group <RESOURCE_GROUP>
    
    1. Deploy via Azure Portal:

    If you prefer the Azure portal:

    • Go to your Function App.
    • Select Deployment Center.
    • Choose your container registry and specify your image.
    1. Monitor & Manage:

    After deployment, keep an eye on your function app's performance and logs to ensure everything is running smoothly.

    References:

    Hope it helps!


    Please do not forget to click "Accept the answer” and Yes, this can be beneficial to other community members.

    User's image

    If you have any other questions, let me know in the "comments" and I would be happy to help you.

    0 comments No comments

Your answer

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