# Error: Cannot assign requested address (Docker)

**URL:** <https://discuss.elastic.co/t/error-cannot-assign-requested-address-docker/133586>\
**Category:** Logstash\
**Created:** [May 28, 2018, 9:46pm UTC](https://discuss.elastic.co/t/error-cannot-assign-requested-address-docker/133586 "2018-05-28T21:46:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brandonmcgr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandonmcgr/32/28789_2.png) [@Brandonmcgr](https://discuss.elastic.co/u/Brandonmcgr)\
**Post date:** [May 28, 2018, 9:46pm UTC](https://discuss.elastic.co/t/error-cannot-assign-requested-address-docker/133586/1 "2018-05-28T21:46:24Z")

</div>

Hello,

I'm running the Logtash image with the following:

`docker run -it --rm -v "$PWD":/config-dir logstash -f /config-dir/logstash.conf`

My logstash file is:

```
input {
    beats{
        host => "192.168.0.66"
        port => 5044
			}
    }

output {
    elasticsearch {
      hosts => ["192.168.0.66:9200","192.168.0.66:9201","192.168.0.66:9202"]
    }
}

```

- Elasticsearch nodes are sitting on 192.168.0.66:9200,9201,9202.
- Kibana on 192.168.0.66:5601
- Logstash on 192.168.0.66:5044

What I am trying to do is send Filebeat (Snort) logs from 192.168.0.67 but no matter which IP I put in the input host, I still get the error.

Edit: Realised I didn't specify the docker network. However, the same issue still arises.

`docker run --network es-net --rm -v "$PWD":/config-dir logstash -f /config-dir/logstash.conf`

If I remove the `host` parameter, it starts on 0.0.0.0 which I still can not access on 192.168.0.66.

22:00:41.013 [[main]-pipeline-manager] INFO logstash.inputs.beats - Beats inputs: Starting input listener {:address=\>"0.0.0.0:5044"}

---

<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:** [May 29, 2018, 5:57am UTC](https://discuss.elastic.co/t/error-cannot-assign-requested-address-docker/133586/2 "2018-05-29T05:57:58Z")

</div>

Unless you run the container in host network mode you won't be able to bind to 192.168.0.66. I suggest you omit the `host` option so that Logstash listens on all network interfaces. If you want port 5044 in the Logstash container to be available on the host you need to publish the port. See [https://docs.docker.com/config/containers/container-networking/](https://docs.docker.com/config/containers/container-networking/).

---

<div class="post-metadata">

**Author:** ![Brandonmcgr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandonmcgr/32/28789_2.png) [@Brandonmcgr](https://discuss.elastic.co/u/Brandonmcgr)\
**Post date:** [May 29, 2018, 8:50pm UTC](https://discuss.elastic.co/t/error-cannot-assign-requested-address-docker/133586/3 "2018-05-29T20:50:37Z")

</div>

Okay I removed the `host` input and changed my command to:  
`docker run -it --rm -p 5044:5044 -v "$PWD":/config-dir logstash -f /config-dir/logstash.conf`  
and it worked!

Thank you!

---

<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:** [June 26, 2018, 8:57pm UTC](https://discuss.elastic.co/t/error-cannot-assign-requested-address-docker/133586/4 "2018-06-26T20:57:02Z")

</div>

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