Error running Kibana docker-compose

Hello everyone,

I am trying to run elk stack in a machine using docker:

OS: Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-45-generic x86_64)

I have installed docker and docker-compose in it.

Then run:

docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.1.1

And I can use curl localhost:9200, perfectly!!!

So I decided to package it into a docker compose file:

version: '2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      - discovery.type=single-node
  kibana:
    image: docker.elastic.co/kibana/kibana:7.1.1
    ports:
      - "5601:5601"
    environment:
      ELASTICSEARCH_HOSTS: http://localhost:9200
    depends_on:
      - elasticsearch

And the elasticsearch is running OK, since I can still access via curl, but Kibana throw an error

kibana_1         | {"type":"log","@timestamp":"2019-06-05T12:07:31Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://localhost:9200/"}
kibana_1         | {"type":"log","@timestamp":"2019-06-05T12:07:31Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"No living connections"}
kibana_1         | {"type":"log","@timestamp":"2019-06-05T12:07:31Z","tags":["warning","task_manager"],"pid":1,"message":"PollError No Living connections"}

What is going on, I also have added container name and replace localhost by the container name with no luck. Any idea of what could be wrong?

Kind regards
Daniel Branco

Hi @dbranco
Try changing the environment var ELASTICSEARCH_HOSTS : http://localhost:9200 to ELASTICSEARCH_HOSTS : http://elasticsearch:9200

I am not an expert in docker-compose, but as far as I know the kibana container needs to connect directly to the elasticsearch container if you use localhost for ELASTICSEARCH_HOSTS: http://localhost:9200 then the connection is addressed to himself(kibana container) instead of the elasticsearch container.

Let me know if this helped.

1 Like

Thank you very much Mathew, I was almost sure I changed it before maybe I had a typo and got desperate blind. I just copy/paste from your comment and solved my problem.

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