-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vm.max_map_count in docker-desktop distro for WSL2 #5202
Comments
@thespatt is there a workaround to getting it work for now? |
Hi, as modifying this sysctl setting would apply to all wsl distros (they all run in the same VM), we won't do that automatically. |
for future me next time I find this issue https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html |
what I have to do on every system restart or docker desktop update: It does seem odd that there's not a way to make this sticky across restarts. @simonferquel is there a way for me to set this permanently at the VM level? |
same here, setting sysctl.conf has no affect, doesn't get loaded, I am close to reverting the bashrc hacks |
@thespatt think I found a possible solution could you verify it for me.
Restart docker-desktop |
I am not sure about persistent sysctl configs. Maybe @benhillis has the info ? |
I wrote "vm.max_map_count=262144" on docker-desktop's /etc/sysctl.d/00-alpine.conf last line. |
Been working fine for me, haven't tried using existing files, created my own. |
same for me. I append the to the end of /etc/sysctl.d/99-sysctl.conf . |
This fixed the issue for me:
|
This seems to be the only thing that's working for me so far. I tried adding setting the |
Note that most kernel settings (except those which can be set per-namespace) will apply both to docker desktop and your own distro. So 3 things:
|
even echoing the setting into @thespatt's solution, however, worked... but I'll have do to it manually every time I restart? |
@joaociocca @DenisValcke @johnsonlu finally solved it! Have to set the environment variable "discovery.type=single-node" I had to solve it because all of the devs on my team will be switching to wsl2 soon and there's no way I can deal with people forgetting to set that. https://twitter.com/thespatt/status/1260221113768062978 |
I'm aware of that setting, but my goal is to make a "realistic lab", so single-node is a no-no. Thanks, though! Hope it helps others where it helps <3 |
This worked for me. Added this to my compose file:
|
Setting this to 262144 as @CyberAP had it works for me, but the problem is that my Docker stack then ends up consuming huge amounts of memory. Before using Docker with WSL2, I had docker-desktop set to use 8GB. With WSL2 and this setting I'm seeing close to 19GB consumed. That's way more than I can spare on my 32GB system due to other required apps. My system is sluggish and apps are running out of memory. Can this be set only for one container (in my case)? Elasticsearch is where I saw a problem. It seems the high mem use is due to the way Linux behaves wrt to allocated memory and caching and adding a .wslconfig file allows setting some parameters to constrain that. |
@asampal if you also add settings you can limit elasticsearch memory per node:
|
I think I'll do that @thespatt - thanks. |
There is a "one-shot" command line to solve it from
So, in to make it stick across restarts, I've created a nasty
and put it at Far from ideal (awful), but it looks like it does the trick. |
cat?
where and what is this? |
In Windows go to Start -> Run (or Win+R) -> and type 'shell:startup' this short path to Win Startup directory -> %APPDATA%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup there create suggested by @beccari .bat file |
The question is why is @gertjvr's solution not working?
|
This worked for me even after restart. Hope it helps others
It worked for me. Hope it will work for you too. |
Are there any news for this topic? |
No. I understand it is difficult for WSL2. |
To all the people saying their fix persists through a "restart", I think you're only testing a Docker for Desktop restart. Everybody else is confused because they're looking for a solution which survives a Windows reboot. These solutions are equivalent, they allow an elasticsearch container to run, but the setting is not persisted after Windows reboots.
Or
Or
Besides running an elasticsearch container you can test by checking this:
Unfortunately the Elastic docs https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#_set_vm_max_map_count_to_at_least_262144 don't mention this reboot problem. As @simonferquel said earlier #5202 (comment):
Simon do you know where the central wsl VM is? Is there a way to make the sysctl permanent, surviving Windows reboots? I wouldn't mind that it affects all wsl distros I run on my PC. |
I have the same issue but with sonarqube using elasticearch , i got [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144], the only thing that worked for me was: |
Your solution works perfect after changing Here is one part of code in my
|
so using |
So how to config |
Thanks a lot! this worked perfectly! |
Issues go stale after 90 days of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
/lifecycle frozen |
Same problem here. I found a nice solution automating the |
/remove-lifecycle stale |
I tried all the approaches and non worked for me... However I was able to set it permanently like this.
To verify it works:
Hope it works for you. |
Hi, we finnaly found the trick via the .wslconfig file : |
Follow the steps in https://techbrij.com/wsl-2-ubuntu-services-windows-10-startup. Change the contents of /etc/init-wsl into: #!/bin/sh That worked fine as a solution for me after a windows reboot and starting wsl. |
Is there any chance that WSL2 and Docker Desktop somehow changed the default values? I can't observe this issue anymore on my machine. |
I recently ran into all the above problems, especially with restart, and the best solution was the one referenced above. |
thanks man! |
Thank you, man 👍 |
When running an elasticsearch container in the WSL2 Tech Preview, the container continually restarts itself complaining "max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]"
Would it be bad to just modify sysctl.conf in the docker-desktop distro to set vm.max_map_count = 262144? I have confirmed that modifying that is persistent across restarts.
Expected behavior
elasticsearch container should start successfully
Actual behavior
elasticsearch container continually restarts itself
Information
Windows 10 Preview Build 19025
2.1.6.1 edge
Steps to reproduce the behavior
DOCKERFILE:
FROM docker.elastic.co/elasticsearch/elasticsearch:6.8.4
RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-phonetic
Compose:
version: '2.4'
services:
elasticsearch:
image: elastic-nwps:6
platform: linux
container_name: elasticsearch
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=false
- "ES_JAVA_OPTS=-Xms1500m -Xmx1500m"
- http.cors.enabled=true
- http.cors.allow-origin="*"
- http.cors.allow-headers="Access-Control-Allow-Origin, X-Requested-With, Content-Type, Content-Length, Authorization"
mem_limit: 2g
restart: always
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
- 9300:9300
networks:
- esnet
The text was updated successfully, but these errors were encountered: