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  is too low, increase to at least 
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
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
Exiting the WSL Environment
Exit the WSL environment using the following command:
Following these steps should resolve the Elasticsearch error related to vm.max_map_count, allowing Elasticsearch to run smoothly.