# Override discovery.type=single-node in docker-compose.yml

**URL:** <https://discuss.elastic.co/t/override-discovery-type-single-node-in-docker-compose-yml/231622>\
**Category:** Elasticsearch\
**Created:** [May 7, 2020, 8:53pm UTC](https://discuss.elastic.co/t/override-discovery-type-single-node-in-docker-compose-yml/231622 "2020-05-07T20:53:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![braddre](https://avatars.discourse-cdn.com/v4/letter/b/a5b964/32.png) [@braddre](https://discuss.elastic.co/u/braddre)\
**Post date:** [May 7, 2020, 8:53pm UTC](https://discuss.elastic.co/t/override-discovery-type-single-node-in-docker-compose-yml/231622/1 "2020-05-07T20:53:42Z")

</div>

I'm using two -c yaml files on the docker-compose command line to provide override of Elasticsearch settings. I have the base settings in docker-compose.yml in the services.elasticsearch.environment, and the override in docker-compose.multi.yml.

The base file settings are for a single-node elasticsearch deployment, so include discovery.type=single-node. What config parameter can I use in docker-compose.multi.yml to override this discovery type and do a multi-node

base:

```
environment:
  - cluster.name=cluster_name
  - network.host=0.0.0.0
  - ELASTIC_PASSWORD=${BOOTSTRAP_PASSWORD}
  - node.name={{.Node.Hostname}}
  - xpack.security.enabled=true
  - discovery.type=single-node

```

multi override:

```
environment:
  - discovery.seed_hosts=elasticsearch
  - cluster.initial_master_nodes=$INITIAL_MASTER_NODES
  - xpack.security.transport.ssl.enabled=true
  - xpack.security.transport.ssl.verification_mode=certificate
  - xpack.security.transport.ssl.certificate_authorities=$CERTS_DIR/ca/ca.crt
  - xpack.security.transport.ssl.certificate=$CERTS_DIR/instance/instance.crt
  - xpack.security.transport.ssl.key=$CERTS_DIR/instance/instance.key
  - "ES_JAVA_OPTS=-Xms512m -Xmx512m"

```

I tried discover.type=multi-node, and then also tried leaving discovery.type out of the override as I've shown here.  
With multi-node ES complains about unknown type.  
Without an override discovery.type I get this error

> setting [cluster.initial\_master\_nodes] is not allowed when [discovery.type] is set to [single-node]

Is there a discovery.type setting that can override single-node value to work with multi-node deployment?

---

<div class="post-metadata">

**Author:** ![braddre](https://avatars.discourse-cdn.com/v4/letter/b/a5b964/32.png) [@braddre](https://discuss.elastic.co/u/braddre)\
**Post date:** [May 8, 2020, 9:05pm UTC](https://discuss.elastic.co/t/override-discovery-type-single-node-in-docker-compose-yml/231622/2 "2020-05-08T21:05:51Z")

</div>

Answering my own question: probably not.  
I have not been able to find the documentation for discovery.type anywhere, does anyone have a link?

But, as you may have guessed, it's easy to get around this without a discovery.type override.  
Here's what I did:

base:

> environment:  
> - xpack.security.transport.ssl.enabled=true

multi-override:

> environment:  
> - discovery.seed\_hosts=elasticsearch  
> - cluster.initial\_master\_nodes=$INITIAL\_MASTER\_NODES

single-node override:

> environment:  
> - discovery.type=single-node

deploy stack single-node:  
`docker stack deploy -c base.yml -c single.yml stack_name`

deploy stack multi-node:  
`docker stack deploy -c base.yml -c multi.yml stack_name`

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [May 9, 2020, 5:47pm UTC](https://discuss.elastic.co/t/override-discovery-type-single-node-in-docker-compose-yml/231622/3 "2020-05-09T17:47:20Z")

</div>

The docs for `discovery.type` are [here](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/modules-discovery-settings.html); you should either set it to `single-node` or not set it at all.

Note also that you should only set `cluster.initial_master_nodes` the first time the cluster is forming; on a restart or when adding new nodes you [shouldn't set this](https://www.elastic.co/guide/en/elasticsearch/reference/current/discovery-settings.html#initial_master_nodes).

---

<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:** [June 6, 2020, 5:52pm UTC](https://discuss.elastic.co/t/override-discovery-type-single-node-in-docker-compose-yml/231622/4 "2020-06-06T17:52:32Z")

</div>

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