I am using Docker Desktop with linux containers on Windows 10 and would like to launch the latest versions of the elasticsearch and kibana containers over a docker compose file.
Everything works fine when using some older version like 6.2.4.
This is the working docker-compose.yml file for 6.2.4.
version: '3.1'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.2.4
container_name: elasticsearch
ports:
- "9200:9200"
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data
networks:
- docker-network
kibana:
image: docker.elastic.co/kibana/kibana:6.2.4
container_name: kibana
ports:
- "5601:5601"
depends_on:
- elasticsearch
networks:
- docker-network
networks:
docker-network:
driver: bridge
volumes:
elasticsearch-data:
I deleted all installed docker containers and adapted the docker-compose.yml file by changing 6.2.4 to 7.0.1. By starting the new compose file everything looks fine, both the elasticsearch and kibana containers are started. But after a couple of seconds the elasticsearch container exits (the kibana container is running further). I restarted everything, attached a terminal to the elasticsearch container and saw the following error message:
...
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
...
What must be changed in the docker-compose.yml file to get elasticsearch 7.0.1 working?
Navigate to the directory where you have created your docker-compose.yml file and create a subdirectory data. Then inside the data directory create another directory elasticsearch. We will be mounting this directory to the data directory of elasticsearch container. In your docker-compose.yml file there are these lines:
You might need to re-pull them before running docker-compose, like docker pull elasticsearch and docker pull kibana .
Don't forget to use one of the documented methods to set Kibana configuration - ELASTICSEARCH_URL is required to be set! I have a docker compose file that creates two elasticsearch nodes and a kibana instance all running on the same bridged network. It is possible.
So when you override command section you must remember to keep existing behavior which is set by image author. So in you case you can actually install kibana plugin this way but you must also add Kibana start at the end of the command by using e.g. && to run process after plugin installation.
Making a few changes worked for me -
Add cluster.initial_master_nodes
to the elasticsearch service in compose -
environment:
- cluster.initial_master_nodes=elasticsearch
vm.max_map_count
on the linux box kernel setting needs to be set to at least 262144 -
$ sudo sysctl -w vm.max_map_count=262144
For development mode, you can use below settings as well -
environment:
- discovery.type=single-node
Working compose file for me -
version: '2.2'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.0.1
container_name: es01
environment:
- cluster.initial_master_nodes=es01
ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9200
For production mode, you must consider having multiple ES nodes/containers as suggested in the official documentation
https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docker.html#docker-cli-run-prod-mode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With