How to run an Elasticsearch 7 single node cluster for local development using Docker Compose?

Tim van Baarsen
2 min readOct 16, 2019

For one of our projects, we recently upgraded an Elasticsearch 6 cluster to Elasticearch version 7. For local development 90% of the time:

  • a single-node Elasticseach cluster will get the job done
  • I want to have XPack disabled

While upgrading my docker-compose.yml to start Elasticsearch 7.x and Kibana 7.x for local development instead of 6.x I ran into issues. My Elasticsearch single node cluster was not starting anymore!

Since version 7 of Elasticsearch, the cluster coordination algorithm has been changed and in order to be ‘safe it requires some specific configuration.

Starting an Elasticsearch 7 cluster for the very first time requires the initial set of master-eligible nodes to be explicitly defined in one or more of the master-eligible nodes in the cluster. This process is known as cluster bootstrapping.

In case you don’t specify, you are running a single node cluster Elasticsearch assumes you are running in ‘production mode’ and the bootstrap checks fail because you didn’t configure your cluster correctly.

Bootstrap error from the logs of the Elasticsearch Docker container:

ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

To run the Elasticsearch 7 Docker image in development mode, you should set discovery.type to single-node. At startup, the bootstrap checks are bypassed. The single node will elect itself as the master node and will not join a cluster with any other node.

A complete docker-compose.yml example to run a single node Elasticsearch 7 Cluster including Kibana:

Start Elasticsearch and Kibana using Docker Compose:

docker-compose up -d

Your Elasticsearch node will startup now, and after a couple of seconds, you can reach it at http://localhost:9200/. Kibana should be running at http://localhost:5601 now.

To shut down Elasticsearch and Kibana run:

docker-compose down

In case you also would like to remove the docker volume while shutting down run:

docker-compose down -v

For more details about Elasticsearch 7 related to my blogpost check out:

Tap the 👏 button if you found this article useful!

Any questions or feedback?
Reach out to me on Twitter: @TimvanBaarsen

--

--

Tim van Baarsen

I’m a creative and passionate software developer living in the Netherlands. Occasional meetup & conference speaker.