# Unable to get Metricbeat to communicate with Elasticsearch

**URL:** <https://discuss.elastic.co/t/unable-to-get-metricbeat-to-communicate-with-elasticsearch/346747>\
**Category:** Beats\
**Tags:** docker, metricbeat\
**Created:** [November 8, 2023, 11:33pm UTC](https://discuss.elastic.co/t/unable-to-get-metricbeat-to-communicate-with-elasticsearch/346747 "2023-11-08T23:33:34Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [November 9, 2023, 8:09pm UTC](https://discuss.elastic.co/t/unable-to-get-metricbeat-to-communicate-with-elasticsearch/346747/15 "2023-11-09T20:09:55Z")

</div>

Ok so when running separate docker containers each container is its own `localhost` so referencing `localhost` in the metricbeat container is not the `localhost` in the elasticsearch container.

This is docker stuff.

Perhaps look at

> [@Filebeat Docker - Elasticsearch Host Issue](https://discuss.elastic.co/t/filebeat-docker-elasticsearch-host-issue/320083/2):
>
> Hi @mwsprotte Welcome to the community! Docker Networking Issue not Elastic... Another explanation Might be worth reading... if you are new to docker try using host.docker.internal docker run \ --net=elastic docker.elastic.co/beats/filebeat:7.17.4 \ setup -E setup.kibana.host=host.docker.internal:5601 \ -E output.elasticsearch.hosts=["https://host.docker.internal:9200"]

So when you want one container to communicate/connect with another container you need to use either the IP of the host or use

`host.docker.internal`

---

_[View the full topic](https://discuss.elastic.co/t/unable-to-get-metricbeat-to-communicate-with-elasticsearch/346747)._
