在容器中运行本地kibana [英] Running a local kibana in a container

查看:75
本文介绍了在容器中运行本地kibana的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将kibana控制台与我的本地Elasticsearch(容器)一起运行 在 ElasticSearch文档中,我看到

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.

查看 kibana文档我只能看到

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

用拉力替换拉动它寻找x-pack(我认为这意味着不属于社区),但找不到ES

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/

是否有一个可以轻松地在容器中设置基巴纳本地化的衬板? 我需要做的就是使用控制台(替换Sense)

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)

推荐答案

如果要在docker本地将kibana与elasticsearch一起使用,它们必须相互通信.为此,根据 doc ,您需要链接容器. 您可以使用--name:

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 \
  --publish 9200:9200 \
  --publish 9300:9300 \
  --env "discovery.type=single-node" \
  docker.elastic.co/elasticsearch/elasticsearch:6.2.2

然后将此容器链接到kibana:

And then link this container to kibana:

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

端口5601在本地公开,可以从浏览器访问它.您可以在监视"部分中检查Elasticsearch的运行状况是否为绿色.

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.

编辑(24/03/2020):

选项--link 最终可能会被删除,现在它已成为码头工人. 重现同一件事的惯用方式是首先创建一个用户定义的网桥:

The option --link may eventually be removed and is now a legacy feature of docker. The idiomatic way of reproduce the same thing is to firstly create a user-defined bridge:

docker network create elasticsearch-kibana

然后在其中创建容器:

docker run \
  --name elasticsearch_container \
  --network elasticsearch-kibana \
  --publish 9200:9200 \
  --publish 9300:9300 \
  --env "discovery.type=single-node" \
  docker.elastic.co/elasticsearch/elasticsearch:6.2.2

docker run \
  --name kibana \
  --publish 5601:5601 \
  --network elasticsearch-kibana \
  --env "ELASTICSEARCH_URL=http://elasticsearch_container:9200" \
  docker.elastic.co/kibana/kibana:6.2.2

版本7

如前所述,环境变量已针对版本7进行了更改.现在为ELASTICSEARCH_HOSTS.

docker run \
  --name elasticsearch_container \
  --network elasticsearch-kibana \
  --publish 9200:9200 \
  --publish 9300:9300 \
  --env "discovery.type=single-node" \
  docker.elastic.co/elasticsearch/elasticsearch:7.6.2

docker run \
  --name kibana \
  --publish 5601:5601 \
  --network elasticsearch-kibana \
  --env "ELASTICSEARCH_HOSTS=http://elasticsearch_container:9200" \
  docker.elastic.co/kibana/kibana:7.6.2

用户定义的网桥可在容器之间提供自动DNS解析,这意味着您可以通过其容器名称相互访问.

User-defined bridges provide automatic DNS resolution between containers that means you can access each other by their container names.

这篇关于在容器中运行本地kibana的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆