Running a local kibana in a container

丶灬走出姿态 提交于 2020-02-17 07:36:08

问题


I am trying to run use kibana console with my local elasticsearch (container) In the ElasticSearch documentation I see

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

Which lets me run the community edition in a quick one liner.

Looking at the kibana documentation i see only

docker pull docker.elastic.co/kibana/kibana:6.2.2

Replacing pull with run it looks for the x-pack (I think it means not community) and fails to find the ES

Unable to revive connection: http://elasticsearch:9200/

Is there a one liner that could easily set up kibana localy in a container? All I need is to work with the console (Sense replacement)


回答1:


If you want to use kibana with elasticsearch locally with docker, they have to communicate with each other. To do so, according to the doc, you need to link the containers. You can give a name to the elasticsearch container with --name:

docker run                        \
  --name elasticsearch_container  \
  -p 9200:9200                    \
  -p 9300:9300                    \
  -e "discovery.type=single-node" \
  docker.elastic.co/elasticsearch/elasticsearch:6.2.2

And then link this container to kibana:

docker run \
  --name kibana \
  -p 5601:5601 \
  --link elasticsearch_container:elasticsearch_alias \
  -e "ELASTICSEARCH_URL=http://elasticsearch_alias:9200" \
  docker.elastic.co/kibana/kibana:6.2.2

The port 5601 is exposed locally to access it from your browser. You can check in the monitoring section that elasticsearch's health is green.




回答2:


It is convenient to use docker-compose as well.
For instance, the file below, stored in home directory, allows to start Kibana with one command:
docker-compose up -d:

# docker-compose.yml

version: "2"
 kibana:
    image: "docker.elastic.co/kibana/kibana:6.2.2"
    container_name: "kibana"
    environment:
      - "ELASTICSEARCH_URL=http://<elasticsearch-endpoint>:9200"
      - "XPACK_GRAPH_ENABLED=false"
      - "XPACK_ML_ENABLED=false"
      - "XPACK_REPORTING_ENABLED=false"
      - "XPACK_SECURITY_ENABLED=false"
      - "XPACK_WATCHER_ENABLED=false"
    ports:
      - "5601:5601"
    restart: "unless-stopped"

In addition, Kibana service might be a part of your project in development environment (in case, docker-compose is used).



来源:https://stackoverflow.com/questions/49088327/running-a-local-kibana-in-a-container

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!