Connect kibana to elastic search in a docker container
Get image from docker hub
Your version of kibana must be the same as your elastic search version.
sh
docker pull docker.elastic.co/kibana/kibana:8.8.2
Set environment variables of container
Kibana doesn't accept 'elastic' as username since version 7.9.0, so you must create a service account token in elastic search and use it in kibana.
sh
ELASTICSEARCH_HOSTS: ["YOUR_ELASTICSEARCH_URL"]
ELASTICSEARCH_SERVICEACCOUNTTOKEN: "<YOUR_SERVICE_ACCOUNT_TOKEN>"
(I don't found environment variable 'ELASTICSEARCH_SERVICEACCOUNTTOKEN' in documentation, but it works)
When the container is started, it will create a kibana.yml file in /usr/share/kibana/config/kibana.yml.
Connection
Username and Password are same as elastic search.