Cannot connect to the Docker daemon

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
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?

@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.

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

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

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

By default on windows i think it listen to TCP see the docker documentation.

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.

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?

`

Hi @cdrouin,

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

That's the URL for Docker daemon on Windows

1 Like

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