Docker swarm not redirecting to site with Traefik v2

I'm new to traefik & was trying to use it along with docker stack, reviewing the examples, I created the docker-stack.yml as follows

version: "3.3"

services:

  traefik:
    image: "traefik:v2.0"
    networks:
      - traefik-net
    command:
      - "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--providers.docker.swarmMode=true"
      - "--providers.docker.endpoint=`tcp://127.0.0.1:2375`"
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

  whoami:
    image: "containous/whoami"
    #container_name: "simple-service"
    networks:
      - traefik-net
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule=Host(`whoami.localhost`)"
      - "traefik.http.routers.whoami.entrypoints=web"
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.whoami.entrypoints=web"
        - "traefik.http.routers.whoami.rule=Host(`whoami.localhost`)"
        - "traefik.http.services.whoami-service.loadbalancer.server.port=8080"

networks:
  traefik-net:

While trying to visit "whoami.localhost" the page doesn't load, wheras, trying on localhost:8080 I'm able to view the traefik dashboard with 1 service active.

Can anyone please let me know if I'm missing any labels on the container OR if I'm doing anying wrong here? On the traefik container logs, I see a error as:

> time="2019-10-21T07:05:37Z" level=error msg="Provider connection error error during connect: Get http://127.0.0.1:2375%60/v1.24/version: dial tcp: lookup 127.0.0.1:2375`: no such host, retrying in 4.506218855s" providerName=docker

The above error occours as soon as I add this line "--providers.docker.endpoint=tcp://127.0.0.1:2375", I'm following the instrucation's as mentioned in v2 docker to enable swarm mode

hello,

You have to replace:

by

      - "--providers.docker.endpoint=tcp://127.0.0.1:2375"

and

by

  whoami:
    image: "containous/whoami"
    #container_name: "simple-service"
    networks:
      - traefik-net
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.whoami.entrypoints=web"
        - "traefik.http.routers.whoami.rule=Host(`whoami.localhost`)"
        - "traefik.http.services.whoami-service.loadbalancer.server.port=80"

Thanks for your inputs. I tried with the changes but didn't appear to work, I still see the error as

 time="2019-10-21T07:36:06Z" level=error msg="Provider connection error Cannot connect to the Docker daemon at tcp://127.0.0.1:2375. Is the docker daemon running?, retrying in 15.394871241s" providerName=docker

Cannot connect to the Docker daemon at tcp://127.0.0.1:2375

127.0.0.1 is resolved inside the traefik container: 127.0.0.1 is the internal IP of the container.

so you have to provide an accessible IP by Traefik or you could try to remove "--providers.docker.endpoint=tcp://127.0.0.1:2375"

I removed "providers.docker.endpoint=tcp://127.0.0.1:2375" and tried visiting " http://127.0.0.1:8080", the traefik dashboard loads up just fine, but I'm unable to reach to the host of the service i.e "whoami", when I visit whoami.localhost on my local machine, the browser just keeps spinning

Thanks for your help Idez, I was able to this get this working by removing the line providers.docker.endpoint=tcp://127.0.0.1:2375, here's my final docker-compose.yml (just for reference)

version: "3.3"

services:

  traefik:
    image: "traefik:v2.0"
    networks:
      - traefik-net
    command:
      - "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--providers.docker.swarmMode=true"
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

  whoami:
    image: "containous/whoami"
    #container_name: "simple-service"
    networks:
      - traefik-net
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule=Host(`whoami.localhost`)"
      - "traefik.http.routers.whoami.entrypoints=web"
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.whoami.entrypoints=web"
        - "traefik.http.routers.whoami.rule=Host(`whoami.localhost`)"
        - "traefik.http.services.whoami-service.loadbalancer.server.port=80"

networks:
  traefik-net: