# Docker module: Can't connect to /var/run/docker.sock

**URL:** <https://discuss.elastic.co/t/docker-module-cant-connect-to-var-run-docker-sock/86835>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [May 23, 2017, 4:39pm UTC](https://discuss.elastic.co/t/docker-module-cant-connect-to-var-run-docker-sock/86835 "2017-05-23T16:39:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BeLi4L](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/beli4l/32/18303_2.png) [@BeLi4L](https://discuss.elastic.co/u/BeLi4L)\
**Post date:** [May 23, 2017, 4:39pm UTC](https://discuss.elastic.co/t/docker-module-cant-connect-to-var-run-docker-sock/86835/1 "2017-05-23T16:39:30Z")

</div>

Hi,

I'm running `metricbeat` with the docker module, with the following configuration:

```yaml
metricbeat.modules:
- module: docker
  period: 20s
  metricsets:
    - container
    - cpu
    - diskio
    - image
    - info
    - memory
  hosts: ["unix:///var/run/docker.sock"]

```

and the following command:

```auto
docker run -d \          
  --network=elk_elk \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v etc:/etc/metricbeat \
  docker.elastic.co/beats/metricbeat:5.4.0 \
  metricbeat -e -c /etc/metricbeat/metricbeat.yml

```

However, in the events sent to Elasticsearch, there's an `error` field, which says

> Get [http://unix.sock/images/json?:](http://unix.sock/images/json?:) dial unix /var/run/docker.sock: connect: permission denied

I noticed that my Docker socket belongs to root:docker (gid 999), which corresponds to the `input` group in the container.

Is there a way to make this Docker module work with my local Unix socket?

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [May 25, 2017, 12:39pm UTC](https://discuss.elastic.co/t/docker-module-cant-connect-to-var-run-docker-sock/86835/2 "2017-05-25T12:39:49Z")

</div>

Try adding `-u root` to the docker command. By default the container image for metricbeat drops privileges.

---

<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 22, 2017, 12:40pm UTC](https://discuss.elastic.co/t/docker-module-cant-connect-to-var-run-docker-sock/86835/3 "2017-06-22T12:40:08Z")

</div>

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