Skip to content

Cannot connect to the Docker daemon #3536

@colinmollenhour

Description

@colinmollenhour

Do you want to request a feature or report a bug?

Bug

What did you do?

Traefik was running with the Docker backend when suddenly it is no longer able to talk to Docker over the daemon socket:

time="2018-06-27T18:20:01Z" level=error msg="Failed to retrieve information of the docker client and server host: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
time="2018-06-27T18:20:01Z" level=error msg="Provider connection error Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?, retrying in 7.365042107s"

After seeing this error in the logs I simply restarted the traefik container (docker restart traefik) and now it is working again.

What did you expect to see?

The Traefik container was working and so should continue to work and not require restarts to be fixed.

What did you see instead?

It suddenly was no longer able to talk to Docker so not being able to communicate with the provider it no longer is able to serve traffic. The docker CLI commands all still worked just fine (e.g. docker ps) indicating that there was nothing wrong with the socket itself. It was broken for several days since this server only serves review apps, but this is concerning since I am considering also using Traefik in production.

Output of traefik version: (What version of Traefik are you using?)

Version:      v1.5.1
Codename:     cancoillotte
Go version:   go1.9.3
Built:        2018-01-29_02:14:02PM
OS/Arch:      linux/amd64

What is your environment & configuration (arguments, toml, provider, platform, ...)?

The configuration is very simple, all running on a single Ubuntu 16.04 machine. A wildcard SSL is used for https (traditional, not ACME). Docker version is 17.12.0-ce.

traefik.toml

defaultEntryPoints = ["http", "https"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[[entryPoints.https.tls.certificates]]
certFile = "/sslmate/*.example.com.chained.crt"
keyFile = "/sslmate/*.example.com.key"
[retry]
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "example.com"
watch = true
exposedbydefault = false

docker-compose.yml

version: '3'

services:
  traefik:
    image: traefik:alpine
    command: --logLevel=DEBUG
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./traefik.toml:/traefik.toml
      - /etc/sslmate:/sslmate
    networks:
      - proxy
    container_name: traefik

networks:
  proxy:
    external: true

If applicable, please paste the log output in DEBUG level (--logLevel=DEBUG switch)

Thousands of entries like this:

time="2018-06-27T18:20:01Z" level=error msg="Failed to retrieve information of the docker client and server host: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
time="2018-06-27T18:20:01Z" level=error msg="Provider connection error Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?, retrying in 7.365042107s"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions