Swarm basic implementation not working

I am trying to switch from nginx to traefik for my reverse proxy. With nginx, everything is working so I know I have no connection issue between me and the servers. I pulled nginx and I'm trying to start with a bare bones traefik implementation but nothing is working

    image: traefik
    command: --web \
      --docker \
      --docker.swarmMode \
      --docker.domain=dev.domain.local \
      --docker.watch \
      - swarm
      - "80:80"
      - "8080:8080"
      - /var/run/docker.sock:/var/run/docker.sock
      - /dev/null:/traefik.toml
        - traefik.port=80
        - traefik.frontend.rule=Host:traefik.dev.domain.local
        - traefik.docker.network=swarm
        constraints: [node.role==manager]

The traefik service logs don't show errors of any kind trying to load the dashboard at traefik.dev.domain.local, only this

"Configuration received from provider docker: {\"backends\":{\"backend-metrics-traefik\":{\"servers\":{\"server-metrics-traefik-1-4972f72b5dbc0e7da567a643dc47c0a8\":{\"url\":\"\",\"weight\":1}},\"loadBalancer\":{\"method\":\"wrr\"}}},\"frontends\":{\"frontend-Host-traefik-dev-domain-local-0\":{\"entryPoints\":[\"http\"],\"backend\":\"backend-metrics-traefik\",\"routes\":{\"route-frontend-Host-traefik-dev-domain-local-0\":{\"rule\":\"Host:traefik.dev.domain.local\"}},\"passHostHeader\":true,\"priority\":0,\"basicAuth\":null}}}"
metrics_traefik.1.kdr3fvhcqzfg@{myhostname}.domain.local    | time="2019-08-14T14:31:52Z" level=info msg="Skipping same configuration for provider docker"

I omitted the host name here, but I can't find anything wrong with what is doing but the browser just says "empty response".

Hello @MrAnderson,

A few questions:

  1. What version of Traefik are you using?
  2. You have configured traefik to listen on port 80, and if the request matches traefik.dev.domain.local, forward it to port 80 on the traefik container...What are you expecting to happen? :wink:
  3. Can you confirm that your docker network is actually just swarm? usually its prefixed with the stack or service name, which can cause you issues down the road.

Thanks for your reply

  1. it is pulling latest which looks like 1.7.13
  2. i'm expecting to see a traefik dashboard at that url?
  3. here is the network list, the network is created outside of this stack
NETWORK ID          NAME                DRIVER              SCOPE
59356c3d974a        bridge              bridge              local
bcfc5bffafff        docker_gwbridge     bridge              local
74b830644d31        host                host                local
143d51c597d2        none                null                local
jec4dmcfvoo5        swarm               overlay             swarm

Hello @MrAnderson,

Friends don't let friends use :latest. Put a tagged image in there, and save yourself headache down the road :wink:

It also will allow you to ensure you are looking at the correct version of the documentation when troubleshooting.

  • The dashboard does not listen on port 80...You have configured a proxy loop...
  • The --web argument is deprecated in version 1.7, and you should be using the --api flag instead: (API / Dashboard - Traefik | Site | v1.7)
  • You need to change the port in your deployment label from 80 -> 8080, since you are wanting to reach the dashboard

With those changes, it should work as expected.

Thanks, I get what you are saying about latest. This isn't the stack file that I plan on using long term, I put a separate stack file together in my solution just to test traefik since it wasn't working in the original implementation so I'm starting bare-bones here. I made these changes but I still cannot load the dashboard.

allLabelsmap[:map[traefik.docker.network:swarm traefik.frontend.rule:Host:traefik.dev.domain.local traefik.port:8080

Configuration received from provider docker: {\"backends\":{\"backend-metrics-traefik\":{\"servers\":{\"server-metrics-traefik-1-81059769c0b97513ef2347cc029e37f9\":{\"url\":\"\",\"weight\":1}},\"loadBalancer\":{\"method\":\"wrr\"}}},\"frontends\":{\"frontend-Host-traefik-dev-domain-local-0\":{\"entryPoints\":[\"http\"],\"backend\":\"backend-metrics-traefik\",\"routes\":{\"route-frontend-Host-traefik-dev-domain-local-0\":{\"rule\":\"Host:traefik.dev.domain.local\"}},\"passHostHeader\":true,\"priority\":0,\"basicAuth\":null}}}"
metrics_traefik.1.4kyv5mv3kf9p@{hostname}.domain.local    | time="2019-08-14T15:02:41Z" level=info msg="Skipping same configuration for provider docker"

Hello @MrAnderson,

What does curl -v http://traefik.dev.domain.local give you?


curl: (7) Failed to connect to traefik.dev.domain.local port 80: Connection refused

I suspected a network or firewall issue but I don't see any listeners on port 80 at the host.

tcp        0      0 *               LISTEN      5429/snmpd
tcp        0      0    *               LISTEN      5433/sshd
tcp        0      0  *               LISTEN      5721/master
tcp6       0      0 :::2377                 :::*                    LISTEN      27160/dockerd
tcp6       0      0 :::9100                 :::*                    LISTEN      5432/node_exporter
tcp6       0      0 :::22                   :::*                    LISTEN      5433/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      5721/master

although the service says it is listening on those ports

ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
v2wutqei08b9        metrics_traefik     replicated          1/1                 traefik:v1.7.13     *:80->80/tcp, *:8080->8080/tcp

@daniel.tomcej thanks for your help. all I did was restart the nodes and it started working as expected. guess I hit a bug with docker somewhere. thanks again!

1 Like