Kibana "Unable to revive connection" to Elasticsearch on Docker

Hi everyone,

I'm using Docker Compose to run Elasticsearch Single Node on Docker with Kibana. I reviewed my files several times and no luck so far.

I'm getting "Unable to revive connection: http://elasticsearch:9200/" message. I tried to declare same network for both containers but I got the same error. When I tried to ping from kibana to elasticsearch container, it responds. Unfortunetely Kibana container doesn't have curl or telnet or even wget to test http://elasticsearch:9200

This is my docker-compose.yaml file:

    version: '3.7'
    services:
      elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:6.3.2
        container_name: elasticsearch
        environment:
          - cluster.name=docker-cluster
          - discovery.type=single-node
        ulimits:
          memlock:
            soft: -1
            hard: -1
          nofile:
            soft: 65536
            hard: 65536
        cap_add:
          - IPC_LOCK
        volumes:
          - esdata:/usr/share/elasticsearch/data
        ports:
          - 9200:9200
          - 9300:9300
      kibana:
        image: docker.elastic.co/kibana/kibana:6.3.2
        container_name: kibana
        environment:
          - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
        ports:
          - 5601:5601
        depends_on:
         - elasticsearch
    volumes:
      esdata:
        driver: local

I just solved my problem...

I had to add two environment variables to elasticsearch container:

      - "http.host=0.0.0.0"
      - "transport.host=127.0.0.1"

And voilá!

Thank you for sharing your solution.

Here is how I'm setting that with docker compose ( docker-compose.yml). It's not exactly the same thing so I thought I'd share it with you:

---
version: '3'
services:

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:$ELASTIC_VERSION
    environment:
      - bootstrap.memory_lock=true
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
      - ELASTIC_PASSWORD=$ELASTIC_PASSWORD
      - xpack.security.enabled=$ELASTIC_SECURITY
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - 9200:9200
    networks: ['stack']

  kibana:
    image: docker.elastic.co/kibana/kibana:$ELASTIC_VERSION
    environment:
      - ELASTICSEARCH_USERNAME=elastic
      - ELASTICSEARCH_PASSWORD=$ELASTIC_PASSWORD
    ports: ['5601:5601']
    networks: ['stack']
    links: ['elasticsearch']
    depends_on: ['elasticsearch']

networks:
  stack: {}

.env file is:

ELASTIC_VERSION=7.6.2
ELASTIC_SECURITY=true
ELASTIC_PASSWORD=changeme
1 Like

Well, thanks for taking your time to reply this.

I really liked your docker-compose.yaml file. I'll use as reference when I upgrade my elasticsearch version to 7. I'm working with 6.3.2 since I need to upgrade others dependencies first in order to migrate everything at once.

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