Aim

In this post we will learn to install Elasticsearch and Kibana using Docker Compose.

Prerequisite

  • Docker must be installed on your machine.
  • Docker compose must be installed on your machine.

Create a docker compose file

touch elasticsearch-docker-compose.yml
  • Put the below components in the file
version: "3.3"
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.0
    container_name: elasticsearch
    restart: always
    environment:
      - xpack.security.enabled=false
      - discovery.type=single-node
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    cap_add:
      - IPC_LOCK
    volumes:
      - elasticsearch-data:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
  kibana:
    container_name: kibana
    image: docker.elastic.co/kibana/kibana:7.4.0
    restart: always
    environment:
      - ELASTICSEARCH_HOSTS=http://elasticsearch:9200    # address of elasticsearch docker container which kibana will connect
    ports:
      - 5601:5601
    depends_on:
      - elasticsearch                                   # kibana will start when elasticsearch has started
volumes:
  elasticsearch-data:

This will start two docker services

  1. Elasticsearch
  2. Kibana

Starting the services

  • You can start the service in foreground mode
docker-compose -f elasticsearch-docker-compose.yml up
  • If you want you can start the services in background mode using
docker-compose -f elasticsearch-docker-compose.yml up -d

Service 1 : Elasticsearch

Elasticsearch is running at PORT 9200

Service 2 : Kibana

Kibana is running at PORT 5601

Happy Coding

5 4 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x