# Metricbeat docker fail to start under not a root user

**URL:** <https://discuss.elastic.co/t/metricbeat-docker-fail-to-start-under-not-a-root-user/174022>\
**Category:** Beats\
**Tags:** docker, metricbeat\
**Created:** [March 26, 2019, 11:21pm UTC](https://discuss.elastic.co/t/metricbeat-docker-fail-to-start-under-not-a-root-user/174022 "2019-03-26T23:21:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![scripnichenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/scripnichenko/32/42838_2.png) [@scripnichenko](https://discuss.elastic.co/u/scripnichenko)\
**Post date:** [March 26, 2019, 11:21pm UTC](https://discuss.elastic.co/t/metricbeat-docker-fail-to-start-under-not-a-root-user/174022/1 "2019-03-26T23:21:08Z")

</div>

Hi Team,  
Task is set-up Docker containers monitoring using Metricbeat container.  
I am following [YAML file as mentioned in this article](https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-docker.html#_example_configuration_file) and trying to use my **metricbeat.docker.yml** but not able to use `--user=root` as I am getting error 😬 :

_Exiting: error loading config file: config file ("metricbeat.yml") must be owned by the beat user (uid=0) or root_

In case when I use `--user=$(id -u)` , I am getting error:

_/usr/local/bin/docker-entrypoint: line 13: metricbeat: command not found_

**What you would recommend (if i am not able to use root user)?**

**Command looks like this:**  
docker run -it   
--name=docker-metricbeat-25   
--user=$(id -u)   
--volume="$HOME/selenoid/elastic/metricbeat.docker.ccs.yml:/usr/share/metricbeat/metricbeat.yml:ro"   
--volume="/var/run/docker.sock:/var/run/docker.sock:ro"   
--volume="/sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro"   
--volume="/proc:/hostfs/proc:ro"   
mydockerhub/beats/metricbeat-oss:6.6.2 metricbeat -e   
-E output.elasticsearch.hosts=["my-host"]

---

<div class="post-metadata">

**Author:** ![scripnichenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/scripnichenko/32/42838_2.png) [@scripnichenko](https://discuss.elastic.co/u/scripnichenko)\
**Post date:** [March 27, 2019, 2:56pm UTC](https://discuss.elastic.co/t/metricbeat-docker-fail-to-start-under-not-a-root-user/174022/2 "2019-03-27T14:56:16Z")

</div>

Solved with: [https://www.elastic.co/guide/en/beats/libbeat/6.6/config-file-permissions.html](https://www.elastic.co/guide/en/beats/libbeat/6.6/config-file-permissions.html)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 24, 2019, 3:01pm UTC](https://discuss.elastic.co/t/metricbeat-docker-fail-to-start-under-not-a-root-user/174022/3 "2019-04-24T15:01:24Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
