Skip to content
Latchkey

Elasticsearch "max virtual memory areas vm.max_map_count [65530] is too low" in CI

Elasticsearch refuses to start because the host kernel's vm.max_map_count is below 262144, failing a bootstrap check. The container exits during startup. Raise the sysctl on the runner before starting the service.

What this error means

The Elasticsearch container exits shortly after launch and the log shows "max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]".

Terminal
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

Common causes

The runner kernel default is too low

Linux defaults vm.max_map_count to 65530, but Elasticsearch needs at least 262144 for its memory-mapped files and enforces it in production mode.

The container cannot change a host sysctl itself

The setting is a host-level kernel parameter, so the image cannot raise it from inside; it must be set on the runner first.

How to fix it

Raise vm.max_map_count before the service starts

Set the sysctl in an early step. Service containers start before steps, so the most reliable approach is to start Elasticsearch yourself after raising it, or run it as a step container.

.github/workflows/ci.yml
- name: Raise vm.max_map_count
  run: sudo sysctl -w vm.max_map_count=262144
- name: Start Elasticsearch
  run: |
    docker run -d --name es -p 9200:9200 \
      -e discovery.type=single-node \
      -e xpack.security.enabled=false \
      docker.elastic.co/elasticsearch/elasticsearch:8.13.0

Set it via sysctl config for the run

Write the value so it applies for the rest of the job.

Terminal
echo 'vm.max_map_count=262144' | sudo tee /etc/sysctl.d/99-es.conf
sudo sysctl --system

How to prevent it

  • Raise vm.max_map_count to 262144 before starting Elasticsearch.
  • Prefer launching ES as a step container so the sysctl is set first.
  • Pin the ES version so bootstrap checks behave consistently.

Frequently asked questions

What causes "Elasticsearch "vm.max_map_count is too low""?
Linux defaults vm.max_map_count to 65530, but Elasticsearch needs at least 262144 for its memory-mapped files and enforces it in production mode.
How do I fix Elasticsearch "vm.max_map_count is too low"?
Set the sysctl in an early step. Service containers start before steps, so the most reliable approach is to start Elasticsearch yourself after raising it, or run it as a step container.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card