# Logstash can't communicate with working Elasticsearch instance

**URL:** <https://discuss.elastic.co/t/logstash-cant-communicate-with-working-elasticsearch-instance/72588>\
**Category:** Logstash\
**Created:** [January 24, 2017, 8:27am UTC](https://discuss.elastic.co/t/logstash-cant-communicate-with-working-elasticsearch-instance/72588 "2017-01-24T08:27:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mormori0n](https://avatars.discourse-cdn.com/v4/letter/m/4491bb/32.png) [@mormori0n](https://discuss.elastic.co/u/mormori0n)\
**Post date:** [January 24, 2017, 8:27am UTC](https://discuss.elastic.co/t/logstash-cant-communicate-with-working-elasticsearch-instance/72588/1 "2017-01-24T08:27:55Z")

</div>

I trying to start ELK stack on docker for collecting netflow data from Cisco routers and use for it blacktop/elastic, blacktop/kibana.  
For logstash I modified blacktop's logstash with netflow codec plugin

Dockerfile:  
`
FROM blacktop/logstash:latest
RUN logstash-plugin install --no-verify --version 3.2.2 logstash-codec-netflow
CMD ["-e", ""]
`

There is result of successfull connection test to elasticserch:  
`
user@vkc-docker:~$ curl localhost:9200
{
"name" : "EC-xBeF",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "fcgWcaimTmSDDCcX-EAghw",
"version" : {
"number" : "5.1.2",
"build_hash" : "c8c4c16",
"build_date" : "2017-01-11T20:18:39.146Z",
"build_snapshot" : false,
"lucene_version" : "6.3.0"
},
"tagline" : "You Know, for Search"
}
`  
But when I start logstash it says that connection to elasticsearch is refused.  
Output I've posted here:  
`
http://pastebin.com/DmASVJvD`

Can everybody help me?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 24, 2017, 8:58am UTC](https://discuss.elastic.co/t/logstash-cant-communicate-with-working-elasticsearch-instance/72588/2 "2017-01-24T08:58:35Z")

</div>

Unless you run the container with `--net=host`, localhost won't be available to the container. See e.g. [http://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach](http://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach) for more on this.

---

<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:** [February 21, 2017, 8:58am UTC](https://discuss.elastic.co/t/logstash-cant-communicate-with-working-elasticsearch-instance/72588/3 "2017-02-21T08:58:46Z")

</div>

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