# Running metricbeat in docker and monitoring the host system does not work with command from documentation

**URL:** <https://discuss.elastic.co/t/running-metricbeat-in-docker-and-monitoring-the-host-system-does-not-work-with-command-from-documentation/119821>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [February 14, 2018, 2:56pm UTC](https://discuss.elastic.co/t/running-metricbeat-in-docker-and-monitoring-the-host-system-does-not-work-with-command-from-documentation/119821 "2018-02-14T14:56:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_H](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_h/32/94049_2.png) [@Christian\_H](https://discuss.elastic.co/u/Christian_H)\
**Post date:** [February 14, 2018, 2:56pm UTC](https://discuss.elastic.co/t/running-metricbeat-in-docker-and-monitoring-the-host-system-does-not-work-with-command-from-documentation/119821/1 "2018-02-14T14:56:57Z")

</div>

I wanted to start a metricbeat container with a custom metricbeat.yml to monitor the host it runs on.

I used this command from the documentation ([https://www.elastic.co/guide/en/beats/metricbeat/6.1/running-on-docker.html#monitoring-host](https://www.elastic.co/guide/en/beats/metricbeat/6.1/running-on-docker.html#monitoring-host)):

docker run \  
--volume=/proc:/hostfs/proc:ro \  
--volume=/sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro \  
--volume=/:/hostfs:ro \  
--volume=/home/user/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml \  
--net=host  
[docker.elastic.co/beats/metricbeat:6.1.3](http://docker.elastic.co/beats/metricbeat:6.1.3) -system.hostfs=/hostfs

There are multiple problems with this:

a) The container starts but there is no output on stdout or in docker logs.  
Doing a docker top on that container shows that there is a metricbeat process

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/d/7dfdb8c0fb66b59071aa77e9f047b4bf6eac0efa.png)

When I specify the option -e at the command, it works:

docker run \  
--volume=/proc:/hostfs/proc:ro \  
--volume=/sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro \  
--volume=/:/hostfs:ro \  
--volume=/home/user/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml \  
--net=host \  
[docker.elastic.co/beats/metricbeat:6.1.3](http://docker.elastic.co/beats/metricbeat:6.1.3) -e -system.hostfs=/hostfs

**Is the -e missing in the documentation?**

b) The command in the documentation has spaces at the end of some lines so copy-pasting the command runs single lines as commands which leads to errors. This should be changed

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [February 14, 2018, 3:08pm UTC](https://discuss.elastic.co/t/running-metricbeat-in-docker-and-monitoring-the-host-system-does-not-work-with-command-from-documentation/119821/2 "2018-02-14T15:08:23Z")

</div>

> [@Christian\_H](#):
>
> Is the -e missing in the documentation?

Yes, sounds like a doc bug. I was thinking that maybe the ENTRYPOINT [script](https://github.com/elastic/beats-docker/blob/master/templates/docker-entrypoint.j2) automatically added `-e` if it wasn't present, but it doesn't. Can you please open an issue or a PR for this is the elastic/beats repo.

> [@Christian\_H](#):
>
> The command in the documentation has spaces at the end of some lines so copy-pasting the command runs single lines as commands which leads to errors.

That must be caused by the Asciidoc callouts. Mention this in the Github issue and I'll point the documentation experts to the issue.

---

<div class="post-metadata">

**Author:** ![Christian\_H](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_h/32/94049_2.png) [@Christian\_H](https://discuss.elastic.co/u/Christian_H)\
**Post date:** [February 14, 2018, 4:39pm UTC](https://discuss.elastic.co/t/running-metricbeat-in-docker-and-monitoring-the-host-system-does-not-work-with-command-from-documentation/119821/3 "2018-02-14T16:39:26Z")

</div>

Ok, I will open a PR.

---

<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:** [March 7, 2018, 2:57pm UTC](https://discuss.elastic.co/t/running-metricbeat-in-docker-and-monitoring-the-host-system-does-not-work-with-command-from-documentation/119821/4 "2018-03-07T14:57:09Z")

</div>

This topic was automatically closed after 21 days. New replies are no longer allowed.
