1001Ferramentas
🔍Dev

docker-compose Elasticsearch Generator

Generate a ready-to-use docker-compose for single-node Elasticsearch, with memory and volume configured. Spin up your local search engine with one command.

YAML

Elasticsearch in a container for development

Bringing up a local Elasticsearch for development usually stalls on two things: it tries to form a cluster and sits waiting for other nodes, and it refuses to start because of the security layer enabled by default in recent versions. Both are solved with environment variables, and that is what separates a file that comes up in seconds from an afternoon of trial and error.

Enter the version and the page assembles the service with both options: single-node discovery, which makes Elasticsearch stop looking for companions and elect itself, and disabling the security layer, which removes the password and certificate requirement. The API port is exposed so the application can reach it.

This configuration is explicitly for development and should stay nowhere near production — with no authentication, anyone on the network can read and delete indices. It is also worth knowing about the system's virtual memory limit: Elasticsearch requires a minimum number of memory map areas that several Linux installations do not have by default, and the symptom is the container dying right after startup with a message about that limit.

Frequently asked questions

Why does it die right after starting?
The most frequent cause is the system's memory map area limit sitting below what Elasticsearch requires. That is host configuration, not container configuration, and it has to be raised with a system command. The second cause is memory: the default heap tends to be far too generous for a development machine.
How do I limit the memory it uses?
Through the Java virtual machine options environment variable, setting minimum and maximum heap to the same value. In development, around 512 megabytes usually suffices. Leaving the default makes the container reserve a large slice of the machine's memory for no reason.
Do I need a dashboard alongside?
For inspecting indices, Kibana helps a great deal, and comes up as a second service pointing at the Elasticsearch address. But it is heavy: for occasional use, querying the API from a terminal or an HTTP client does the job without doubling memory consumption.

Related Tools