# Can't make Metricbeat to use passed env variable

**URL:** https://discuss.elastic.co/t/cant-make-metricbeat-to-use-passed-env-variable/193148
**Category:** Beats
**Tags:** metricbeat
**Created:** [July 31, 2019, 2:56pm UTC](https://discuss.elastic.co/t/cant-make-metricbeat-to-use-passed-env-variable/193148 "2019-07-31T14:56:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![pavlovdog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pavlovdog/32/51341_2.png) [@pavlovdog](https://discuss.elastic.co/u/pavlovdog)
#### Post date: [July 31, 2019, 2:56pm UTC](https://discuss.elastic.co/t/cant-make-metricbeat-to-use-passed-env-variable/193148/1 "2019-07-31T14:56:17Z")

</div>

I'm trying to run `metricbeat` service in docker, according to the [official documentation](https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-docker.html) (version 7.2.0). Here's my bash command for `setup`:

```bash
docker run -d --name=metricbeat docker.elastic.co/beats/metricbeat:7.2.0 setup\
 -e setup.kibana.host=http://XXX.XXX.XXX.XXX:5601\
 -e output.elasticsearch.host=["XXX.XXX.XXX.XXX:9200"]\
 -e output.elasticsearch.password=XXXXXXXX

```

As you see I'm passing the `output.elasticsearch.host` variable and it's definitely not equal to the default value. But here's the part of the `metricbeat` container logs:

```bash
2019-07-31T14:32:40.335Z INFO elasticsearch/client.go:166 Elasticsearch url: http://elasticsearch:9200

```

This means that `metricbeat` used the default Elastic host instead of the environment variable value. How can I fix it?

Thanks in advance!

---

<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: [August 28, 2019, 2:56pm UTC](https://discuss.elastic.co/t/cant-make-metricbeat-to-use-passed-env-variable/193148/2 "2019-08-28T14:56:23Z")

</div>

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