How to set up memory limit for docker in web app

Anonymous
2023-09-08T09:56:45.7366667+00:00

Hello
I'm using docker container in azure web app.
Right now I need to limit the RAM consumption of the docker process.
How can i set up RAM limit in azure web app if i can't use docker run with flags in web app

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

2 answers

Sort by: Most helpful
  1. AirGordon 7,150 Reputation points
    2023-09-10T22:02:51.4466667+00:00

    You need to provide an additional AppSetting in the site configuration to override the default.

    It is limited by the memory available on the App Service host from your selected SKU (P0v3, 4 GiB and P1v3, 8 GiB).

    You need to provide the value in MB.

    Here's an ARM infrastructure as code file which shows exactly how to set the memory (and lots of other parameters); https://github.com/MaxMelcher/mevitco.profile.runtime/blob/da4a37a2fa83a8cc1f59c0957ca9ce72457341d9/mainTemplate.json#L178

    User's image

    1 person found this answer helpful.

  2. Dan Rios 2,020 Reputation points MVP
    2023-09-10T19:02:33.4333333+00:00

    By default all Windows Containers deployed in Azure App Service are limited to 1GB RAM. You can change this value by providing the following setting as an app setting - CONTAINER_MEMORY: defined in MB and must be <= to the total physical memory of the host.

    https://github.com/Azure/app-service-windows-containers/wiki/things-you-should-know#all-containers-have-1gb-ram-assigned-by-default-but-you-can-configure-this-setting

    Have you tried the app config value from above? Not sure if you’re using Linux or Windows but it should help you out. Hope this helps.


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.