DEV Community

shun
shun

Posted on

Configuring vm.max_map_count for Elasticsearch in Docker using WSL

Configuring vm.max_map_count for Elasticsearch in Docker using WSL

When running Elasticsearch on Docker, you might encounter an error message like the following if the default value of vm.max_map_count is too low:

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
Enter fullscreen mode Exit fullscreen mode

To resolve this error, you need to use Windows Subsystem for Linux (WSL) to properly configure the value of vm.max_map_count.

Accessing Docker Desktop's WSL Environment
Open a command prompt and access the WSL environment of Docker Desktop using the following command:

PS C:\work\project\logstash> wsl -d docker-desktop
Enter fullscreen mode Exit fullscreen mode

Modifying System Settings
Once inside the WSL environment, use the following command to change the value of vm.max_map_count:

DESKTOP-XXXXXXX:/path/to/directory# sysctl -w vm.max_map_count=262144
Enter fullscreen mode Exit fullscreen mode

Exiting the WSL Environment
Exit the WSL environment using the following command:

DESKTOP-XXXXXXX:/path/to/directory# exit
Enter fullscreen mode Exit fullscreen mode

Following these steps should resolve the Elasticsearch error related to vm.max_map_count, allowing Elasticsearch to run smoothly.

Top comments (0)