# Filebeat 7.3.0 Autodiscover configuration introduction yields "Cannot connect to the Docker daemon" error

**URL:** https://discuss.elastic.co/t/filebeat-7-3-0-autodiscover-configuration-introduction-yields-cannot-connect-to-the-docker-daemon-error/193974
**Category:** Beats
**Tags:** docker, filebeat
**Created:** [August 6, 2019, 9:50am UTC](https://discuss.elastic.co/t/filebeat-7-3-0-autodiscover-configuration-introduction-yields-cannot-connect-to-the-docker-daemon-error/193974 "2019-08-06T09:50:08Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![nmccoy](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@nmccoy](https://discuss.elastic.co/u/nmccoy)
#### Post date: [August 6, 2019, 9:50am UTC](https://discuss.elastic.co/t/filebeat-7-3-0-autodiscover-configuration-introduction-yields-cannot-connect-to-the-docker-daemon-error/193974/1 "2019-08-06T09:50:09Z")

</div>

I would like to roll out an ELK stack using filebeat to transport logs from custom docker containers. The OS is Ubuntu 18.04.

I am trying to do this by using the filebeat autodiscover feature by following the documentation:

[https://www.elastic.co/guide/en/beats/filebeat/current/configuration-autodiscover.html](https://www.elastic.co/guide/en/beats/filebeat/current/configuration-autodiscover.html)

In the documentation is states that you should just add a `filebeat.autodiscover` field to the yaml file.

Here is what I have done:

1. Run the docker container and copy the default config
2. Add in the filebeat.autodiscover in the documentation

If I run with the filebeat.yaml file containing the `filebeat.autodiscover` field, it does not run and gives the following error:

```auto
2019-08-06T09:46:40.913Z	ERROR	instance/beat.go:877	Exiting: error in autodiscover provider settings: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Exiting: error in autodiscover provider settings: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

```

Here is my `filebeat.yaml` config file:

```auto
filebeat.config:
  modules:
    path: ${path.config}/modules.d/*.yml
    reload.enabled: false

filebeat.autodiscover:
  providers:
    - type: docker
      labels.dedot: true
      templates:
        - condition:
            contains:
              docker.container.image: redis
          config:
            - type: docker
              containers.ids:
                - "${data.docker.container.id}"
              exclude_lines: ["^\\s+[\\-`('.|_]"] # drop asciiart lines

processors:
- add_cloud_metadata: ~

output.elasticsearch:
  hosts: '${ELASTICSEARCH_HOSTS:elasticsearch:9200}'
  username: '${ELASTICSEARCH_USERNAME:}'
  password: '${ELASTICSEARCH_PASSWORD:}'

```

And i am running the command:

```auto
$ docker run -v ~/elastic/filebeat/filebeat.yml:/usr/share/filebeat/filebeat.yml docker.elastic.co/beats/filebeat:7.3.0

```

where `~/elastic/filebeat/filebeat.yml` contains the config

When I remove the `filebeat.autodiscover` section, the config runs without the error.

Thank you for any suggestions

---

<div class="post-metadata">

### Author: ![Michal\_Pristas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michal_pristas/32/46639_2.png) [@Michal\_Pristas](https://discuss.elastic.co/u/Michal_Pristas)
#### Post date: [August 6, 2019, 12:01pm UTC](https://discuss.elastic.co/t/filebeat-7-3-0-autodiscover-configuration-introduction-yields-cannot-connect-to-the-docker-daemon-error/193974/2 "2019-08-06T12:01:11Z")

</div>

is user used to run filebeat part of your `docker` group?

---

<div class="post-metadata">

### Author: ![nmccoy](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@nmccoy](https://discuss.elastic.co/u/nmccoy)
#### Post date: [August 6, 2019, 3:14pm UTC](https://discuss.elastic.co/t/filebeat-7-3-0-autodiscover-configuration-introduction-yields-cannot-connect-to-the-docker-daemon-error/193974/3 "2019-08-06T15:14:03Z")

</div>

I dont specify a `--user` argument to docker, just the command posted above.  
Is this necessary, and if so why?

---

<div class="post-metadata">

### Author: ![Michal\_Pristas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michal_pristas/32/46639_2.png) [@Michal\_Pristas](https://discuss.elastic.co/u/Michal_Pristas)
#### Post date: [August 9, 2019, 1:19pm UTC](https://discuss.elastic.co/t/filebeat-7-3-0-autodiscover-configuration-introduction-yields-cannot-connect-to-the-docker-daemon-error/193974/4 "2019-08-09T13:19:14Z")

</div>

> [@nmccoy](#):
>
> Cannot connect to the Docker daemon

my thinking was that filebeat is not able to connect to docker daemon to subscribe for events.  
if this is the case, please check if

- docker is running
- user which is used for running filebeat has access rights for `/var/run/docker.sock`

usually `/var/run/docker.sock` is accessible for owner and a group where owner is a `root` and group set to `docker`. check whether user used to run filebeat is member of a `docker` group

---

<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: [September 6, 2019, 1:19pm UTC](https://discuss.elastic.co/t/filebeat-7-3-0-autodiscover-configuration-introduction-yields-cannot-connect-to-the-docker-daemon-error/193974/5 "2019-09-06T13:19:16Z")

</div>

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