cabellwg
cabellwg

Reputation: 43

Traefik 2.2 cannot connect to Docker Swarm API over TCP

Running Docker 18.09.7ce with Docker API v1.39 on Ubuntu 18.04 LTS.

I'm trying to set up Traefik 2.2 as a reverse proxy for some swarm services but for some reason Traefik can't connect to the Docker daemon via the TCP port given in the Traefik documentation. These three error messages keep repeating.

level=debug msg="FIXME: Got an status-code for which error does not match any expected type!!!: -1" status_code=-1 module=api
level=error msg="Failed to retrieve information of the docker client and server host: Cannot connect to the Docker daemon at tcp://127.0.0.1:2377. Is the docker daemon running?" providerName=docker
level=error msg="Provider connection error Cannot connect to the Docker daemon at tcp://127.0.0.1:2377. Is the docker daemon running?, retrying in 1.461723532s" providerName=docker

It's running on a manager node (I only have one node) and the swarm is working fine, with the API exposed via that TCP port, as shown by the output of the following command.

$ sudo ss --tcp --listening --processes --numeric | grep ":2377"
LISTEN   0         128                       *:2377                   *:*        users:(("dockerd",pid=30747,fd=23))  

My architecture is based on this blog post, with a shared overlay network called proxy created with docker network create --driver=overlay proxy.

I tried this but it didn't work, and I can't really find any other related questions. Here are my configuration files:

traefik.toml

[providers.docker]
  endpoint = "tcp://127.0.0.1:2377"
  swarmMode = true
  network = "proxy"

[entryPoints]
  [entryPoints.web]
    address = ":80"
  [entryPoints.web-secure]
    address = ":443"

[certificatesResolvers.le.acme]
  email = "[email protected]"
  storage = "/letsencrypt/acme.json"
  caserver = "https://acme-staging-v02.api.letsencrypt.org/directory" # For testing
  [certificatesResolvers.le.acme.httpChallenge]
    entryPoint = "web"

[log]
  level = "DEBUG"

traefik.yml

version: "3.7"

services:
  reverse-proxy:
    deploy:
      placement:
        constraints:
          - node.role == manager
    image: "traefik:v2.2"
    ports:
      - 80:80
      - 443:443
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "/path/to/traefik.toml:/etc/traefik/traefik.toml"
      - "letsencrypt:/letsencrypt"
    networks:
      - "proxy"

networks:
  proxy:
    external: true

volumes:
  letsencrypt:

Upvotes: 4

Views: 1786

Answers (1)

Patrick Magee
Patrick Magee

Reputation: 362

The only difference I can see is that the blog does not explicitly define an endpoint for the dockers provider. Maybe to removing that?

Upvotes: 3

Related Questions