# Elasticsearch running in a docker container: How identify it as target for log events?

**URL:** <https://discuss.elastic.co/t/elasticsearch-running-in-a-docker-container-how-identify-it-as-target-for-log-events/237791>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [June 19, 2020, 10:53am UTC](https://discuss.elastic.co/t/elasticsearch-running-in-a-docker-container-how-identify-it-as-target-for-log-events/237791 "2020-06-19T10:53:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smm](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@smm](https://discuss.elastic.co/u/smm)\
**Post date:** [June 19, 2020, 10:53am UTC](https://discuss.elastic.co/t/elasticsearch-running-in-a-docker-container-how-identify-it-as-target-for-log-events/237791/1 "2020-06-19T10:53:29Z")

</div>

Dear community,  
I am askig myself this: I have as test a docker-compose.yml up & running with 5 nodes - 3 es node, 1 kibana, 1 logstash. Each and everyone in its container. So far so good. Now I wanted to send from a vm a log event to that cluster. To do so, I need the ip of the receiving, dockerized node - could be that of an esnode for a beat sending or that one of the container with logstash inside.  
My question is: I presume the IPs of containers are somehow dynamic. Then how can I address a dockerized node? Fixed IPs in a docker container??? Surely I am not the first to have this question.  
The point is: the sending agent not being part of that single docker-compose.yml does not 'know' and can't address just so via name the dockerized services.  
How do You did this? If you need more details, I am happy to provide them.  
Kind regards  
Stefano

PS: Idea: Perhaps just using the IP of the host containing the docker containers? If so, are there better alternatives?  
PPS: Yep. It worked with the host IP - Do you have better solutions?

---

<div class="post-metadata">

**Author:** ![abrx](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abrx/32/43881_2.png) [@abrx](https://discuss.elastic.co/u/abrx)\
**Post date:** [June 19, 2020, 12:22pm UTC](https://discuss.elastic.co/t/elasticsearch-running-in-a-docker-container-how-identify-it-as-target-for-log-events/237791/2 "2020-06-19T12:22:21Z")

</div>

Hi,

Port-forwarding with host ip seems the simplest way to do this.

However, you could also try a front component with service discovery in order to route requests to your ES container, like [Traefik](https://docs.traefik.io/routing/providers/docker/).

---

<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:** [July 17, 2020, 12:22pm UTC](https://discuss.elastic.co/t/elasticsearch-running-in-a-docker-container-how-identify-it-as-target-for-log-events/237791/3 "2020-07-17T12:22:41Z")

</div>

Closed on July 17, 2020, 12:22pm UTC

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