So, I'm running a container that is showing this in the log:

WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

Spending most of my life in Windows I'm about 80% Linux ignorant, and as far as I can tell, when setting this setting it does it system wide, which will also affect all the other containers. Do I want to do this?

Is there some way to set this for only the container that is recommending it? I should add in case it helps, that I'm running docker desktop in WSL2 mode.

Update: As requested in his comment, I'm adding the container this question is about; it's called Papermerge.

  • 1
    You did not specify which container in use, please edit your question to add that. I assume Redis, given the support conversations specific to their container with the exact message. Feb 11, 2021 at 20:53
  • @JohnMahowald I updated the question as requested; it's not Redis specifically, but the container does use Redis, which is the portion which is giving the message. Feb 11, 2021 at 22:13
  • How about, "Disable memory overcommit entirely and provide enough swap space"? Obligatory: lwn.net/Articles/104185 Feb 11, 2021 at 22:43

2 Answers 2


Is there some way to set this for only the container that is recommending it?

No. vm.overcommit_memory is a Linux kernel tunable, at the host level, not the container level. Value of 0 is a more cautious overcommit than 1.

Redis's reasoning for recommending 1 is their background save mechanism. Big in memory database processes forks itself to save a copy, suddenly Linux guesses it might need up to double the memory, and doesn't allow the fork. Not desirable for Redis, which doesn't change that memory, only wants a copy on write snapshot.

Success would be containers performing well by memory metrics, and processes not dying or failing to fork due to lack of memory. Probably unlikely even if you set it to 1, but capacity planning is your task as system administrator.

  • Thanks, that's what I suspected, but wasn't sure. As someone with more experience in the area, which would you personally do in the case of a simple, home network where the container itself gets small to moderate use just leave it at 0 and ignore the message? Feb 11, 2021 at 22:14
  • 1
    Select either. If Redis cannot fork a background save, 0 isn't working. If performance degrades badly due to memory reclaim, 1 might be too optimistic about overcommit. In between these extremes it doesn't matter much. Feb 12, 2021 at 5:30

what you do is set privileged mode on for redis, then run sysctl vm.overcommit_memory=1 in console, then turn off privileged mode. Only way I was able to get this damn variable changed, after spending more time than I should have typing various solutions I found after searching google concerning this matter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .