# Metricbeat docker compose environment variables

**URL:** https://discuss.elastic.co/t/metricbeat-docker-compose-environment-variables/298009
**Category:** Beats
**Tags:** elastic-stack-monitoring, docker, metricbeat
**Created:** [February 23, 2022, 10:25am UTC](https://discuss.elastic.co/t/metricbeat-docker-compose-environment-variables/298009 "2022-02-23T10:25:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![TobiasSackmann](https://avatars.discourse-cdn.com/v4/letter/t/d2c977/32.png) [@TobiasSackmann](https://discuss.elastic.co/u/TobiasSackmann)
#### Post date: [February 23, 2022, 10:25am UTC](https://discuss.elastic.co/t/metricbeat-docker-compose-environment-variables/298009/1 "2022-02-23T10:25:45Z")

</div>

Hi all,

I am trying to set up stack monitoring using docker via docker compose.  
Here is a sample I found on the Internet that uses the ELASTICSEARCH\_HOSTS variable. I'd like to define more in this section like the module to be used etc.

```auto

  metricbeat:
    image: docker.elastic.co/beats/metricbeat:7.11.1
    environment:
      ELASTICSEARCH_HOSTS: http://node01:9200
    volumes:
      - metricbeat-data01:/usr/share/metricbeat/data
    networks:
      - es-network
    depends_on:
      - node01

```

I'd like to configure as much as possible directly via docker compose, but I cannot find a detailed list of available environment variables. Could you please share the list or even better provide a link to the correct documentation side?

---

<div class="post-metadata">

### Author: ![TiagoQueiroz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tiagoqueiroz/32/107061_2.png) [@TiagoQueiroz](https://discuss.elastic.co/u/TiagoQueiroz)
#### Post date: [February 24, 2022, 6:04pm UTC](https://discuss.elastic.co/t/metricbeat-docker-compose-environment-variables/298009/2 "2022-02-24T18:04:16Z")

</div>

Hi @TobiasSackmann

There are some ways you can configure metricbeat without having to edit the file:

- You can create a configuration file that uses some environment variables as [explained in our docs](https://www.elastic.co/guide/en/beats/libbeat/8.0/config-file-format-env-vars.html)
- Use [CLI arguments](https://www.elastic.co/guide/en/beats/libbeat/8.0/config-file-format-cli.html) to override some elements from the configuration file

The docker image you're using uses a [configuration file that reads from environment variables](https://github.com/elastic/beats/blob/main/deploy/docker/metricbeat.docker.yml), it has got something like that:

```auto
output.elasticsearch:
  hosts: '${ELASTICSEARCH_HOSTS:elasticsearch:9200}'
  username: '${ELASTICSEARCH_USERNAME:}'
  password: '${ELASTICSEARCH_PASSWORD:}'

```

Hence the values you can configure using environment variables.

---

<div class="post-metadata">

### Author: ![TobiasSackmann](https://avatars.discourse-cdn.com/v4/letter/t/d2c977/32.png) [@TobiasSackmann](https://discuss.elastic.co/u/TobiasSackmann)
#### Post date: [March 1, 2022, 2:52pm UTC](https://discuss.elastic.co/t/metricbeat-docker-compose-environment-variables/298009/3 "2022-03-01T14:52:52Z")

</div>

The problem is not the output.Elasticsearch section which is filled by the  
ELASTICSEARCH\_HOSTS variable. I would rather need the kibana equivalent to fill this section.

```auto
setup.kibana:
  host: 'kibana:5601'

```

Currently the setup.kibana part is completely missing when I have a look at the metricbeat.yml within the docker container.

Unfortunately, none of your links provides a full list of variables nor does the metricbeat.reference.yml within the docker container.

A full list of environment variables that are processed would be appreciated(or at least the one for the kibana hosts).

Kind regards  
Tobias

---

<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 29, 2022, 4:53pm UTC](https://discuss.elastic.co/t/metricbeat-docker-compose-environment-variables/298009/4 "2022-03-29T16:53:11Z")

</div>

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