Setting environment variables

The -e flag allows us to set environment variables. Environment variables set with the -e flag will override any environment variables set in the Dockerfile.

One of Elasticsearch’s biggest strengths is that it is a distributed data storage system, where multiple nodes form a cluster that collectively holds all the pieces of the whole dataset. When developing with Elasticsearch, however, we don’t need this clustering.

Therefore, we are setting the environment variable discovery.type to the value of single-node to tell Elasticsearch to run as a single node, and not attempt to join a cluster (because there are no clusters).

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.