Linking kibana with elasticsearch

I have the following docker containers on my box ...

CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                              NAMES
5da7523e527b        kibana              "/docker-entrypoint.s"   About a minute ago   Up About a minute   0.0.0.0:5601->5601/tcp             elated_lovelace
20aea0e545ca        elasticsearch       "/docker-entrypoint.s"   3 hours ago          Up 3 hours          0.0.0.0:9200->9200/tcp, 9300/tcp   sad_meitner

      

My goal was to get the kibana to reference my elasticsearch container, however when I got to the kibana it told me that I don't have any document repositories. I know this is wrong because I definitely have docs in elasticsearch. I am assuming my link is incorrect.

This is the docker command I used to run the kibana container.

docker run -p 5601:5601 --link sad_meitner:elasticsearch -d kibana 

      

Can someone tell me what I did wrong?

thank

0


source to share


2 answers


First of all, the link is a deprecated feature: first create a user-defined network:

docker network create mynetwork --driver=bridge

      

Now use mynetwork

for the containers you want to communicate with each other.

docker run -p 5601:5601 --name kibana -d --network mynetwork kibana 
docker run -p 9200:9200 -p 9300:9300 --name elasticsearch -d --network mynetwork elasticsearch

      



Docker will launch dns server

for your user-defined network, so you can ping another container by name.

docker exec -it kibana /bin/bash
ping elasticsearch

      

You can use telnet

or curl

to test kibana-> elasticsearch connectivity from kibana container.

ps I used official (library)

docker for ELK stack with user defined network and it worked like a charm.

+4


source


you can add ENV ELASTICSEARCH_URL=elasticsearch:9200

to your dockerfile before building kibana and then use docker-compose to run elasticsearch with kibana like this:



version: '2'
services:
  elasticsearch:
   image: docker.elastic.co/elasticsearch/elasticsearch:5.3.0
   container_name: elasticsearch
   ports:
    - "9200:9200"
    - "9300:9300"
  environment:
    ES_JAVA_OPTS: "-Xmx256m -Xms256m"
 kibana:
  image: docker.elastic.co/kibana/kibana:5.3.0
  container_name: kibana
  ports:
    - "5601:5601"
  depends_on:
   - elasticsearch

      

+1


source







All Articles