gpt4 book ai didi

logging - Dockerized Kibana外部化日志

转载 作者:行者123 更新时间:2023-12-02 19:41:39 27 4
gpt4 key购买 nike

我一直在尝试外部化在docker容器中运行但没有运气的kibana日志。我的 docker 组成如下:

  kibana:
image: kibana:latest
container_name: kib
ports:
- "5601:5601"
links:
- elasticsearch
volumes:
- /var/log:/var/log

和Kibana.yml-logging.dest = / var / log / kibana.log

但是,当我运行它时,在容器中收到如下错误:
events.js:85
throw er; // Unhandled 'error' event
^
Error: EACCES, open '/var/log/kibana.log'
at Error (native)

它看起来像是权限问题(我正在Ubuntu FYI上运行它)。我将主机上文件夹的权限设置为7777。有什么想法吗?谢谢

最佳答案

kibana进程由kibana user (defined in the Dockerfile)作为 ENTRYPOINT "/docker-entrypoint.sh" script运行。

如本similar issue所示

The dockerfile creates a user named sinopia and runs everything as that.
In general this is good practice, however, when accessing the host file system docker uses the same uid on the host as is used on the container. Root in container has root access on host, and user sinopia with id 1000 in container is mapped to user 1000 on host.

If you create a user on the host with id 1000 you can then grant this user permissions to the host directory as desired.



检查由Dockerfile创建的用户sinatra的ID,并查看是否可以在主机上授予对该相同ID的访问权限。

如果您使用 chmod +777,请重试 docker-compose up。 (对其他 docker images like libreboard 完成)

OP sharman解释 in the comments为什么chmod 777无效:

Yes I had the user created (so that I could run docker without sudo) and was UID 1000 GID 1000.
However my volume mapping was incorrect - I have mapped the volume to a non existent folder on kibana and config file was point to this one.

关于logging - Dockerized Kibana外部化日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34804179/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com