docker 中不能 运行 metricbeat

Can not run metricbeat in docker

我正尝试在 windows 机器上使用 docker 运行 metricbeat,并且我已根据我的要求更改了 metricbeat.yml。

docker run -v /c/Users/someuser/docker/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml docker.elastic.co/beats/metricbeat:5.6.0

但出现这些错误

metricbeat2017/09/17 10:13:19.285547 beat.go:346: CRIT Exiting: error loading config file: config file ("metricbeat.yml") can only be writable by the owner but the permissions are "-rwxrwxrwx" (to fix the permissions use: 'chmod go-w /usr/share/metricbeat/metricbeat.yml') Exiting: error loading config file: config file ("metricbeat.yml") can only be writable by the owner but the permissions are "-rwxrwxrwx" (to fix the permissions use: 'chmod go-w / usr/share/metricbeat/metricbeat.yml')

为什么我会收到这个?

在docker容器中永久更改文件内容的正确方法是什么(因为我不想每次容器启动时都更改配置文件)

编辑: 容器并不意味着需要编辑/changed.If,docker 卷管理可用于外部化所有配置相关 works.Thanks

所以我认为您可以在此处执行 2 个选项。

首先是您可以确保文件具有适当的权限:

chmod 644 metricbeat.yml

或者您可以 运行 带有 -strict.perms=false 的 docker 命令,其中标记 metricbeat 不应该关心 metricbeat.yml 文件的权限。

docker run \
  docker.elastic.co/beats/metricbeat:5.6.0 \
  --volume="/c/Users/someuser/docker/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml" \
  -strict.perms=false

您可以在下面的 link 中查看有关该标志的更多文档: https://www.elastic.co/guide/en/beats/metricbeat/current/command-line-options.html#global-flags