Master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster Docker Container



Question: How do you solve the Kibana Error: Master not discovered yet, this node has not previously joined a bootstrapped cluster? Am trying to spin up an Elastic Search Cluster with two nodes but one node (a Second Node) can not be discovered. 

Solution: There could be other things in play with looking to resolve this issue, follow the steps below:

1. Make sure that the docker-compose.yaml file is well configured.
       - Pay attention to the version of Docker Compose, a different version e.g. 3.2 requires a different format. The docker-compose found at https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html does not work when you are using docker-compose 3.2. The version used in the link above is 2.2, hence some other format has to be changed.

- Instead of:

     

environment:
      - node.name=es01
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es02,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"

Type this:

 environment:
      xpack.security.enabled: 'true'
      node.name: nodeNameHere
      cluster.name: clusterNameHere
      discovery.seed_hosts: FirstNodeNameHere
      cluster.initial_master_nodes: FirstNodeHere,AnotherNodeNameHere
      ES_JAVA_OPTS: '-Xms512m -Xmx512m'

2. Make sure that Kibana Service Environment Variable has the correct Elasticsearch Url and the port as
ELASTICSEARCH_HOSTS=http//locationWhereElasticSearchIsListening:Port

[NB] Comment below if you need any help configuring Elastic Search.