version: "3.0"
services:
elasticsearch:
container_name: es-container
image: docker.elastic.co/elasticsearch/elasticsearch:7.11.0
environment:
- xpack.security.enabled=false
- "discovery.type=single-node"
volumes:
- ./esdata:/usr/share/elasticsearch/data
networks:
- es-net
ports:
- 9200:9200
kibana:
container_name: kb-container
image: docker.elastic.co/kibana/kibana:7.11.0
environment:
- ELASTICSEARCH_HOSTS=http://es-container:9200
networks:
- es-net
depends_on:
- elasticsearch
ports:
- 5601:5601
volumes:
- kibanadata:/usr/share/kibana/data
networks:
es-net:
driver: bridge
volumes:
esdata:
driver: local
kibanadata:
driver: local
This doesn’t run ES in a cluster or have a password enabled, Also I need a version of 8, when I try that I get an error connecting kibana with ES.
Can some help me with a working docker-compose.yaml
2
Answers
With 8.x where security is enabled by default this is a little more complicated, but the documentation has a fully working example: https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docker.html#docker-compose-file
Replace
8.3
with the version you are trying to set up and it will give you a working configuration.Best thing to do is to use template here: docker-elk.
Then you can read documentation and find what exactly is happening here. It is pretty awesome repo and help you master elk without much in-depth explore in docker.