3

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

mnhmilu
  • 2,327
  • 1
  • 30
  • 50
  • Try running this `docker run -v /c/Users/someuser/docker/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml docker.elastic.co/beats/metricbeat:5.6.0 chmod go-w / usr/share/metricbeat/metricbeat.yml` and then your command and see if it helps. If it doesn't help then it may be because of the fact that originally the files or on windows and windows doesn't have such permissions. So even if you make the change it will not be persisted – Tarun Lalwani Sep 17 '17 at 13:55
  • command is not working. Fortunately , I have managed to start the metricbeat container by creating a new file within virtual machine and command was docker run -v /home/docker/metricbeat/metricbeat.yml:/usr/share/metricbea‌​t/metricbeat.yml --name metricbeat docker.elastic.co/beats/metricbeat:5.6.0 instead of accessing windows location. There must be a better approach to do that. – mnhmilu Sep 18 '17 at 05:55

1 Answers1

5

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

skukx
  • 617
  • 5
  • 15