# Docker container receive "master not discovered exception" after authentication

**URL:** <https://discuss.elastic.co/t/docker-container-receive-master-not-discovered-exception-after-authentication/178778>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [April 28, 2019, 4:56am UTC](https://discuss.elastic.co/t/docker-container-receive-master-not-discovered-exception-after-authentication/178778 "2019-04-28T04:56:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abelchun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abelchun/32/45167_2.png) [@abelchun](https://discuss.elastic.co/u/abelchun)\
**Post date:** [April 28, 2019, 4:56am UTC](https://discuss.elastic.co/t/docker-container-receive-master-not-discovered-exception-after-authentication/178778/1 "2019-04-28T04:56:19Z")

</div>

I'm setting up elastic search production docker-compose environment, I copied exactly the same as in the official website [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-dev-mode). Everything worked fine after deploy. When I add `ELASTIC_PASSWORD` env with xpack enable and xpack trial generated license.

My docker container results in `master_not_discovered_exception` in /\_cluster/health.

```
{
  "error": {
    "root_cause": [
      {
        "type": "master_not_discovered_exception",
        "reason": null
      }
    ],
    "type": "master_not_discovered_exception",
    "reason": null
  },
  "status": 503
}

```

**Docker-compose.yml**

```
version: '2.2'
services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.0.0
    container_name: es01
    environment:
      - ELASTIC_PASSWORD=elastic_password
      - xpack.security.enabled=true
      - xpack.license.self_generated.type=trial
      - discovery.seed_hosts=es02
      - node.name=es01
      - cluster.initial_master_nodes=es01,es02
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet
      - traefik-public
  es02:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.0.0
    container_name: es02
    environment:
      - ELASTIC_PASSWORD=elastic_password
      - xpack.security.enabled=true
      - xpack.license.self_generated.type=trial
      - node.name=es02
      - discovery.seed_hosts=es01
      - cluster.initial_master_nodes=es01,es02
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata02:/usr/share/elasticsearch/data
    networks:
      - esnet
```

---

<div class="post-metadata">

**Author:** ![Yogesh\_Gaikwad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yogesh_gaikwad/32/27025_2.png) [@Yogesh\_Gaikwad](https://discuss.elastic.co/u/Yogesh_Gaikwad)\
**Post date:** [April 30, 2019, 2:11am UTC](https://discuss.elastic.co/t/docker-container-receive-master-not-discovered-exception-after-authentication/178778/2 "2019-04-30T02:11:13Z")

</div>

Hi @abelchun,

I tried with your docker-compose.yml file and it works fine for me. I just had to add the volumes and networks configuration for defaults.  
I think you may have some docker-networking configuration which might be impacting cluster formation but without knowing what error you are getting its difficult to tell.  
Could you please post the logs, that might help us better understand what might be going on?

Thanks and Regards,  
Yogesh Gaikwad

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 28, 2019, 2:11am UTC](https://discuss.elastic.co/t/docker-container-receive-master-not-discovered-exception-after-authentication/178778/3 "2019-05-28T02:11:13Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
