DEV Community

Birol AYDIN
Birol AYDIN

Posted on

Installing Elasticsearch and Kibana with Docker compose

  • Briefly installing Elasticsearch and Kibana with Docker compose.
  • You can work with Elasticsearch and Kibana running in docker environment by following the steps below.
//Windows powershell
mkdir Elasticsearch8.7.1
Enter fullscreen mode Exit fullscreen mode
cd Elasticsearch8.7.1
Enter fullscreen mode Exit fullscreen mode
New-Item -Path "docker-compose.yml"
Enter fullscreen mode Exit fullscreen mode
code .
Enter fullscreen mode Exit fullscreen mode

*NOTE: Before running docker-compose, make sure Docker is installed and running on your computer :)
*

// docker-compose.yml
version: '3'
services:
  elasticsearch:
    container_name: elasticsearch
    image: docker.elastic.co/elasticsearch/elasticsearch:8.7.1
    # 8.x
    environment: ['CLI_JAVA_OPTS=-Xms2g -Xmx2g','bootstrap.memory_lock=true','discovery.type=single-node','xpack.security.enabled=false', 'xpack.security.enrollment.enabled=false']
    ports:
      - 9200:9200
    networks:
      - elastic
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    deploy:    
      resources:
          limits:
            cpus: '2.0'
          reservations:
            cpus: '1.0'

  kibana:
    image: docker.elastic.co/kibana/kibana:8.7.1
    container_name: kibana
    environment:
      XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: d1a66dfd-c4d3-4a0a-8290-2abcb83ab3aa
    ports:
      - 5601:5601
    networks:
      - elastic
    deploy:    
      resources:
          limits:
            cpus: '2.0'
          reservations:
            cpus: '1.0'

networks:
  elastic:
Enter fullscreen mode Exit fullscreen mode

In the directory where docker-compose is located

docker-compose  up
Enter fullscreen mode Exit fullscreen mode

You can see the containers working from Docker Desktop application. Click on the links Elasticsearch and kibana to see that both are ready to use.

Image description

Image description

Latest comments (1)

Collapse
 
jerasokcm profile image
jerasokcm • Edited

Good starting point. Thanks.

Two questions:

1) Is the data persistent with this setup?
2) Is the Kibana instance ready to access the Elasticsearch data or there is the need to do additional configuration?