# Unable to connect filebeat to elastic search host

**URL:** <https://discuss.elastic.co/t/unable-to-connect-filebeat-to-elastic-search-host/326260>\
**Category:** Beats\
**Tags:** docker, filebeat\
**Created:** [February 23, 2023, 5:42am UTC](https://discuss.elastic.co/t/unable-to-connect-filebeat-to-elastic-search-host/326260 "2023-02-23T05:42:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shrivatsa\_Rao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shrivatsa_rao/32/117625_2.png) [@Shrivatsa\_Rao](https://discuss.elastic.co/u/Shrivatsa_Rao)\
**Post date:** [February 23, 2023, 5:42am UTC](https://discuss.elastic.co/t/unable-to-connect-filebeat-to-elastic-search-host/326260/1 "2023-02-23T05:42:53Z")

</div>

Hi I am running filebeat docker image with following command  
`docker run docker.elastic.co/beats/filebeat:8.6.2 setup -E setup.kibana.host=http://localhost:5601 -E output.elasticsearch.hosts=["https://localhost:9200"] ` but it **says connect: cannot assign requested address**.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/2/c26339b5afb9aeeee44631f649a38bb3ce326955.png)

I have conformed that my Elasticsearch is running on [http://localhost:9200](http://localhost:9200)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/5/0573081c7799a1a4f1d363eb725c95d1bfaa7b62.png)

Let me know if I am missing anything, any quick help is appreciated.  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 23, 2023, 6:08am UTC](https://discuss.elastic.co/t/unable-to-connect-filebeat-to-elastic-search-host/326260/2 "2023-02-23T06:08:45Z")

</div>

Welcome to our community! 😃

Please don't post pictures of text, logs or code. They are difficult to read, impossible to search and replicate (if it's code), and some people may not be even able to see them 🙂

---

<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:** [February 23, 2023, 6:10am UTC](https://discuss.elastic.co/t/unable-to-connect-filebeat-to-elastic-search-host/326260/3 "2023-02-23T06:10:10Z")

</div>

@Shrivatsa_Rao

Perhaps Take a look at this ... Localhost within your docker container is not localhost of the host/ server

> [@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"]

---

<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 23, 2023, 8:10am UTC](https://discuss.elastic.co/t/unable-to-connect-filebeat-to-elastic-search-host/326260/4 "2023-03-23T08:10:36Z")

</div>

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