# Cannot connect to the Docker daemon

**URL:** <https://discuss.elastic.co/t/cannot-connect-to-the-docker-daemon/135406>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [June 11, 2018, 4:19pm UTC](https://discuss.elastic.co/t/cannot-connect-to-the-docker-daemon/135406 "2018-06-11T16:19:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cdrouin](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@cdrouin](https://discuss.elastic.co/u/cdrouin)\
**Post date:** [June 11, 2018, 4:19pm UTC](https://discuss.elastic.co/t/cannot-connect-to-the-docker-daemon/135406/1 "2018-06-11T16:19:21Z")

</div>

Hi I'm getting an error running a custom image on my local dev maching using Docker for Windows (in Linux Container Mode).

Error

> 2018-06-11T15:16:44.491Z ERROR instance/beat.go:667 Exiting: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?  
> Exiting: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I created the image with:

> FROM [docker.elastic.co/beats/filebeat:6.2.4](http://docker.elastic.co/beats/filebeat:6.2.4)  
> COPY filebeat.yml /usr/share/filebeat/filebeat.yml

filebeat.yml

> filebeat.autodiscover:  
> #List of enabled autodiscover providers  
> providers:  
> - type: docker  
> templates:  
> - condition:  
> equals.docker.container.image: busybox  
> config:  
> - type: log  
> paths:  
> - /var/lib/docker/containers/${data.docker.container.id}/\*.log
> 
> #================================ Outputs =====================================  
> output.elasticsearch:  
> #Array of hosts to connect to.  
> hosts: ["localhost:9200"]

Any thoughts?

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [June 11, 2018, 5:49pm UTC](https://discuss.elastic.co/t/cannot-connect-to-the-docker-daemon/135406/2 "2018-06-11T17:49:54Z")

</div>

@cdrouin by default we will use the unix socket to connect to the docker daemon, to be honest I am not too familiar about docker on Windows but I guess this strategy doesn't work.

The docker provider supports a _host_ and _ssl_ options, so I think you should be able to use that instead.

```auto
providers:
- type: docker
  host: "127.0.0.1:9999"
```

---

<div class="post-metadata">

**Author:** ![cdrouin](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@cdrouin](https://discuss.elastic.co/u/cdrouin)\
**Post date:** [June 11, 2018, 7:16pm UTC](https://discuss.elastic.co/t/cannot-connect-to-the-docker-daemon/135406/3 "2018-06-11T19:16:16Z")

</div>

Is there another approach I should be using to configure filebeats so it can pull logs from my docker microservices?

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [June 11, 2018, 7:34pm UTC](https://discuss.elastic.co/t/cannot-connect-to-the-docker-daemon/135406/4 "2018-06-11T19:34:23Z")

</div>

Did you try giving it the "host:port"?

By default on windows i think it listen to TCP see the [docker documentation](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-socket-option).

> Similarly, the Docker client can use -H to connect to a custom port. The Docker client will default to connecting to unix:///var/run/docker.sock on Linux, and tcp://127.0.0.1:2376 on Windows.

---

<div class="post-metadata">

**Author:** ![cdrouin](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@cdrouin](https://discuss.elastic.co/u/cdrouin)\
**Post date:** [June 11, 2018, 8:40pm UTC](https://discuss.elastic.co/t/cannot-connect-to-the-docker-daemon/135406/5 "2018-06-11T20:40:40Z")

</div>

> [@pierhugues](#):
>
> host: "127.0.0.1:9999"

I tried a few variations and received the same error. Looking at the docker for windows settings, there is a feature I enabled: Expose daemon on tcp://localhost:2375. This one seemed promising but still no luck.  
`

> host: "tcp://127.0.0.1:2375"

The error was the same:

> Exiting: Cannot connect to the Docker daemon at tcp://127.0.0.1:2375. Is the docker daemon running?

`

---

<div class="post-metadata">

**Author:** ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)\
**Post date:** [June 12, 2018, 4:03pm UTC](https://discuss.elastic.co/t/cannot-connect-to-the-docker-daemon/135406/6 "2018-06-12T16:03:12Z")

</div>

Hi @cdrouin,

You can try using `host: ["npipe://./pipe/docker_engine"]`

That's the URL for Docker daemon on Windows

---

<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:** [July 10, 2018, 4:11pm UTC](https://discuss.elastic.co/t/cannot-connect-to-the-docker-daemon/135406/7 "2018-07-10T16:11:08Z")

</div>

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