Kibana in docker while elasticsearch in host machine - is it possible? - please help

i Pulled Docker image for Kibana 7.6.2. Is there a way the kibana connects to host machine elasticsearch ? if yes what parameter should i give in the docker run command ?
i tried
docker run -d --name kibana761 -e ELASTICSEARCH_HOSTS=http://localhost:9200 -p 5601:5601 docker.elastic.co/kibana/kibana:7.6.2

when i run the container it says no living connectsions. Should the elasticsearch also be in another container ?

Hi @Venkatesh_Murthy,

To have Kibana connect to Elasticsearch you need to use the --link parameter. See example from: https://www.elastic.co/guide/en/kibana/current/docker.html

 docker run --link YOUR_ELASTICSEARCH_CONTAINER_NAME_OR_ID:elasticsearch -p 5601:5601 {docker-repo}:{version}

Hope this helps,

Thanks
Liza

the example you provided is giving link to another container, my question is about linking it to host machine's instance and not to another container.

Hi @Venkatesh_Murthy,

Yes you can connect the host machine, sorry I missed that. Add --network host to your docker run command for starting Kibana.

Thanks,
Liza

i provided the following command:

docker run -d --name kibana761 --network host -p 5601:5601 docker.elastic.co/kibana/kibana:7.6.2

and the container is still unable to connect and says unable to revive connections, no living connections as errors

Thanks @Venkatesh_Murthy,

For your command above did you also include:
-e ELASTICSEARCH_HOSTS=http://localhost:9200 ?

If so, can you try to run curl command on elasticsearch to see if it is running
curl -X GET 'localhost:9200/_cluster/health?pretty

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.