How to setup docker container memory limit over 1GB in a Azure Web App container on deployment

Carlos Solorzano 0 Reputation points
2024-03-07T16:39:06.0166667+00:00

I have a ASP. Net backend targetting .Net Framework 4.8 that has been dockerized. I push the docker image to an azure image repository and then use this image to deploy it as an AppService Web App on deployment in the Log I can see that the assigned memory limit is 1GB, on my subscription I can use up to 8GB. I have seen other questions and searched online and I find that I can use an app setting called CONTAINER_MEMORY and another one called WEBSITE_MEMORY_LIMIT_MB. I have setup values for both of this settings in the app settings for the web app in the azure console but I see no effect for this values when deploying the container image. Do I need to do something in the dockerfile itself?

Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
327 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dan Rios 1,735 Reputation points MVP
    2024-03-08T10:09:28.15+00:00

    How many apps are on that Web App Plan (assuming it is a premium plan)? If more than one, I believe this will impact the total memory assignment for each app, outside the default so that's is something to keep in mind - you may want to create a new app plan if that is the case.

    You're right to use the app setting WEBSITE_MEMORY_LIMIT_MB as this is the necessary app setting to increase beyond the default limit. Double check the value is a valid MB number. E.g. 4GB will be 4096. I don't believe the container memory one is necessary so maybe remove this, and restart the app and see how that goes.

    Read more here: https://video2.skills-academy.com/en-us/azure/app-service/configure-custom-container?pivots=container-windows&tabs=debian#customize-container-memory

    Memory check

    In addition, you can view the memory assignment instantly via the backend KUDU service:

    • Locate your App > Under Development Tools on the left find Advanced Tools > Go > Process Explorer and you should be able to view the memory allocation.

    Let us know how you get on, if you need more help drop a comment. If this solves your issue, feel free to mark as an accepted answer. Cheers!

    0 comments No comments