Traefik v2.0 Docker Swarm Service Labels

Hello,

I have a quick question with regards to the service labels when deploying Traefik v2.0 in Docker Swarm. For the Docker Swarm service with the Traefik v2.0 image (using docker compose yaml file), under deploy > labels, do I want to have that set to traefik.enable=false? I have pasted a snippet of a docker compose to make it clearer of what I am talking about.

version: "3.7"
services:
  traefik:
    image: traefik:v2.0.0-alpha8-alpine
    deploy:
      replicas: 1
      labels:
        - "traefik.enable=false"
      placement:
        constraints:
          - "node.role == manager"

Thank you,
Chris

Hi Chris,

I think the most relevant part of the documentation regarding your question is:
https://docs.traefik.io/v2.0/providers/docker/#exposedbydefault

And to answer it, I think that you indeed need to set traefik.enable=false on your traefik container if you want it to ignore itself. That is, if you haven't already set exposedbydefault to false.

hth,
Mathieu

Hello,

Thank you for your reply. It was very helpful. I just have a quick follow up question for you. Would there ever be a reason for me to add docker labels traefik service itself?

You mean, is there a reason to add labels to the container that runs traefik itself?

Correct. I want to use the best practices when deploying traefik.