You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker部署Kibana与Elasticsearch:连接意外关闭问题排查

问题分析与解决

核心问题

从Kibana日志能看到关键线索:

log   [11:07:07.816] [info][listening] Server running at http://localhost:5601
log   [11:07:08.421] [info][server][Kibana][http] http server running at http://localhost:5601

挂载自定义kibana.yml时,你未配置server.host参数,导致Kibana仅监听容器内部的localhost(127.0.0.1),外部请求无法通过容器的5601端口触达服务,因此出现连接意外关闭的错误。

而使用environment配置时,官方Kibana Docker镜像的默认配置会将server.host设为0.0.0.0(监听所有网卡),所以外部可以正常访问。

解决方案

在你的自定义kibana.yml中添加以下配置:

server.host: "0.0.0.0"

修改后的完整kibana.yml如下:

server.host: "0.0.0.0"
elasticsearch.hosts: ["http://elasticsearch:9200"]

xpack.apm.serviceMapEnabled: true
xpack.encryptedSavedObjects.encryptionKey: something_at_least_32_characters
xpack.reporting.encryptionKey: something_at_least_32_characters
xpack.security.encryptionKey: something_at_least_32_characters

xpack.actions.preconfigured:
  email_notifications:
     name: Gmail Server
     actionTypeId: .email
     config:
       service: other
       from: test@gmail.com
       host: smtp.gmail.com
       port: 587
       secure: false
     secrets:
       user: test@gmail.com
       password: password

额外检查项

  1. 文件权限:确保挂载的kibana.yml文件权限允许容器内的Kibana用户(UID 1000)读取,可执行以下命令调整:
chown 1000:1000 ./kibana.yml
  1. 重启容器:修改配置后,重启Kibana容器使配置生效:
docker-compose restart kibana

内容的提问来源于stack exchange,提问作者Edoardo Zucchelli

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 16:24:55