How to set the vm.overcommit_memory parameter when running docker desktop on win11?

If you use the WSL2 backend You can change it temporarily by simply starting a WSL distribution, and running

sudo sysctl -w vm.overcommit_memory=1

It will not be persistent and I don’t know if you could make it persistent.
One idea is that you could try to run a privileged container but that should start before everything else.

docker run --restart always -d --privileged --init --name sysctl-updater bash -c "while true; do sysctl -w vm.overcommit_memory=1; sleep 10; done"

This way it will change the setting when it starts and do the same change in case something changes it back in every 10 seconds.