Useful or not, from you.
for-win vm.max_map_count in docker-desktop distro for WSL2

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 Version: Windows 10 Preview Build 19025
  • Docker Desktop Version: 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

That's a useful answer
Without any help

@thespatt think I found a possible solution could you verify it for me.

  • open powershell
  • wsl -d docker-desktop
  • echo "vm.max_map_count = 262144" > /etc/sysctl.d/99-docker-desktop.conf

Restart docker-desktop