Skip to main content

Documentation

📘 Elasticsearch + Kibana Setup with Docker Compose (8.x & 9.x)

This guide explains how to run Elasticsearch and Kibana locally using Docker Compose, for both the 8.x and 9.x releases.

1. Snapshot Naming Convention Example

Example snapshot repository pattern (used in 8.x and 9.x):
<auto-snap1-{now/m{yyyy.MM.dd-HH.mm|+05:30}}>

2. Elasticsearch + Kibana (8.x Example: 8.18.4)

version: "3.9"

services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.18.4
    container_name: elasticsearch
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=false
      - ES_JAVA_OPTS=-Xms2g -Xmx2g
    volumes:
      - esdata:/usr/share/elasticsearch/data
    ports:
      - "9200:9200"

  kibana:
    image: docker.elastic.co/kibana/kibana:8.18.4
    container_name: kibana
    environment:
      - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
    depends_on:
      - elasticsearch
    ports:
      - "5601:5601"

volumes:
  esdata:
Notes for 8.x
  • Security (xpack.security.enabled) is disabled for simplicity.
  • Java heap set to 2g.
  • Minimal environment variables (Kibana only needs ELASTICSEARCH_HOSTS).

3. Elasticsearch + Kibana (9.x Example: 9.1.0)

version: "3.9"

services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:9.1.0
    container_name: elasticsearch
    ports:
      - "9200:9200"
    mem_limit: 2g
    environment:
      - discovery.type=single-node
      - network.host=0.0.0.0
      - ES_JAVA_OPTS=-Xms1g -Xmx1g
      - xpack.security.enabled=false
    volumes:
      - esdata:/usr/share/elasticsearch/data

  kibana:
    image: docker.elastic.co/kibana/kibana:9.1.0
    container_name: kibana
    ports:
      - "5601:5601"
    depends_on:
      - elasticsearch
    environment:
      - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
      - XPACK_SECURITY_ENABLED=false
      - XPACK_MONITORING_ENABLED=false
      - XPACK_WATCHER_ENABLED=false
      - XPACK_ML_ENABLED=false

volumes:
  esdata:
Notes for 9.x
  • Added network.host=0.0.0.0 for broader connectivity.
  • Memory limit explicitly set (mem_limit: 2g).
  • Java heap adjusted to 1g (default smaller footprint).
  • More explicit Kibana flags disabling X-Pack features like monitoring, watcher, ML.

4. Run the Stack

docker-compose up -d
Check containers:
docker ps
Access:

5. Key Differences (8.x vs 9.x)

Feature8.x (8.18.4)9.x (9.1.0)
Java Heap2g1g
Memory Limit (mem_limit)Not set2g
network.hostNot requiredRequired (0.0.0.0)
X-Pack flags in KibanaMinimalExplicit (security, monitoring, watcher, ML disabled)
CompatibilityStableLatest features, breaking changes possible

✅ Executive Summary

  • Use 8.x (8.18.4) for stability with fewer config flags.
  • Use 9.x (9.1.0) for latest features, requires more explicit configuration.
  • Both can be run via Docker Compose with minor adjustments in heap size, memory, and network.host.
  • Disable X-Pack security & monitoring for local/dev use.

a snapshot repository + restore example (using that auto-snap1-{now/m{yyyy.MM.dd-HH.mm|+05:30}} pattern)