I'm running my redis server on a docker container hosted on my local windows machine, but i am unable to store data because of this warning
WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see 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.is there a way i can enable this?
version: '3'
services: redis: image: "redis" ports: - "6379:6379" networks: - my-service
networks: my-service: external: true 4 1 Answer
First of all, it has nothing to do with the Redis image or container itself and there isn't any direct way to resolve it through the docker-compose or the docker run command. It's merely related to the host OS which in Windows case is the Linux hypervisor which docker runs on top of it.
If you use the WSL2 backend like me to run docker on your Windows, you can change it temporarily by simply starting a WSL distribution, and running:
sudo sysctl -w vm.overcommit_memory=1It will not be persistent by the way. Unfortunately dealing with this issue requires a good knowledge of Linux to work against user permissions, strange access denies, package managers, etc and for me, coming from the Windows background, it was a tough task to dig into this issue any further.