Can not run metricbeat in docker

4.3k views Asked by At

I am trying to run metricbeat using docker in windows machine and I have changed metricbeat.yml as per my requirement.

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

but getting these error

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')

Why I am getting this?

What is the right way to make permanent change in file content in docker container (As I don't want to change configuration file each time when container start)

Edit: Container is not meant to be edited / changed.If necessary, docker volume management is available to externalize all configuration related works.Thanks

1

There are 1 answers

1
skukx On BEST ANSWER

So there are 2 options you can do here I think.

The first is that you can ensure the file has the proper permissions:

chmod 644 metricbeat.yml

Or you can run your docker command with -strict.perms=false which flags that metricbeat shouldn't care about what permissions are on the metricbeat.yml file.

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

You can see more documentation about that flag in the link below: https://www.elastic.co/guide/en/beats/metricbeat/current/command-line-options.html#global-flags