# Filebeat in a docker container

**URL:** https://discuss.elastic.co/t/filebeat-in-a-docker-container/264864
**Category:** Beats
**Tags:** filebeat
**Created:** [February 19, 2021, 1:45pm UTC](https://discuss.elastic.co/t/filebeat-in-a-docker-container/264864 "2021-02-19T13:45:14Z")
**Posts on this page:** 4
**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: [February 19, 2021, 1:45pm UTC](https://discuss.elastic.co/t/filebeat-in-a-docker-container/264864/1 "2021-02-19T13:45:14Z")

</div>

Dear community,  
I have a server on openstack. This target I can reach from everywhere else beside from inside the filebeat docker on my laptop.

If I make an ip add on my laptop I get a bunch of IPs. All these IPs I can reach from inside the conainer. A ping to the target from inside the filebeat container is not possible - but possible from my laptop where the container runs.  
That is why I get this error:  
2021-02-19T13:28:42.177Z ERROR [publisher\_pipeline\_output] pipeline/output.go:155 Failed to connect to backoff(async(tcp://10.98.146.18:5044)): dial tcp 10.98.146.18:5044: i/o timeout  
2021-02-19T13:28:42.178Z INFO [publisher\_pipeline\_output] pipeline/output.go:146 Attempting to reconnect to backoff(async(tcp://10.98.146.18:5044)) with 8 reconnect attempt(s)  
Do you perhaps know how I can start the dock container / do so that it also finds / reach the target Ip? I do not understand the reason for this behaviour  
Thank you and kind regards  
Stefano

---

<div class="post-metadata">

### Author: ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)
#### Post date: [February 19, 2021, 4:49pm UTC](https://discuss.elastic.co/t/filebeat-in-a-docker-container/264864/2 "2021-02-19T16:49:05Z")

</div>

Hey @smm,

This is more a question about networking 🙂

Do you access to this server on OpenStack through some VPN?

Can filebeat access the server if you run it on the host network (with `--net=host`)?

Take a look to this question in stack overflow, it may be the a similar thing: [networking - Docker container and host network VPN - Stack Overflow](https://stackoverflow.com/questions/33904647/docker-container-and-host-network-vpn)

---

<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: [February 20, 2021, 8:42am UTC](https://discuss.elastic.co/t/filebeat-in-a-docker-container/264864/3 "2021-02-20T08:42:31Z")

</div>

Hi jsoriano,  
thanks for the input.  
I found the solution I would like to share now:

docker run   
--rm   
--net host   
--name=filebeat   
--user=root   
--volume="$(pwd)/filebeat.docker-local.yml:/usr/share/filebeat/filebeat.yml:ro"   
--volume="/var/lib/docker/containers:/var/lib/docker/containers:ro"   
--volume="/var/run/docker.sock:/var/run/docker.sock:ro"   
[docker.elastic.co/beats/filebeat:7.8.1](http://docker.elastic.co/beats/filebeat:7.8.1) filebeat -e -strict.perms=false  
Running on latets linux mint.  
The --net host made the difference!  
cheers  
Stefano

---

<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 20, 2021, 10:42am UTC](https://discuss.elastic.co/t/filebeat-in-a-docker-container/264864/4 "2021-03-20T10:42:43Z")

</div>

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