Browse Source

[DOCS] Forward-port persisting vm.max_map_count for WSL2 (#87276)

Nikola Grcevski 2 years ago
parent
commit
f117f76460
1 changed files with 40 additions and 2 deletions
  1. 40 2
      docs/reference/setup/install/docker.asciidoc

+ 40 - 2
docs/reference/setup/install/docker.asciidoc

@@ -403,14 +403,52 @@ sudo sysctl -w vm.max_map_count=262144
 
 ====== Windows with https://docs.docker.com/docker-for-windows/wsl[Docker Desktop WSL 2 backend]
 
-The `vm.max_map_count` setting must be set in the docker-desktop container:
+The `vm.max_map_count` setting must be set in the "docker-desktop" WSL instance before the
+ElasticSearch container will properly start. There are several ways to do this, depending
+on your version of Windows and your version of WSL.
+
+If you are on Windows 10 before version 22H2, or if you are on Windows 10 version 22H2 using the
+built-in version of WSL, you must either manually set it every time you restart Docker before starting
+your ElasticSearch container, or (if you do not wish to do so on every restart) you must globally set
+every WSL2 instance to have the `vm.max_map_count` changed. This is because these versions of WSL
+do not properly process the /etc/sysctl.conf file.
+
+To manually set it every time you reboot, you must run the following commands in a command prompt
+or PowerShell window every time you restart Docker:
 
 [source,sh]
 --------------------------------------------
-wsl -d docker-desktop
+wsl -d docker-desktop -u root
 sysctl -w vm.max_map_count=262144
 --------------------------------------------
 
+If you are on these versions of WSL and you do not want to have to run those commands every
+time you restart Docker, you can globally change every WSL distribution with this setting
+by modifying your %USERPROFILE%\.wslconfig as follows:
+
+[source,text]
+--------------------------------------------
+[wsl2]
+kernelCommandLine = "sysctl.vm.max_map_count=262144"
+--------------------------------------------
+
+This will cause all WSL2 VMs to have that setting assigned when they start.
+
+If you are on Windows 11, or Windows 10 version 22H2 and have installed the Microsoft Store
+version of WSL, you can modify the /etc/sysctl.conf within the "docker-desktop" WSL
+distribution, perhaps with commands like this:
+
+[source,sh]
+--------------------------------------------
+wsl -d docker-desktop -u root
+vi /etc/sysctl.conf
+--------------------------------------------
+
+and appending a line which reads:
+[source,text]
+--------------------------------------------
+vm.max_map_count = 262144
+--------------------------------------------
 
 ===== Configuration files must be readable by the `elasticsearch` user