# Not clear about the traefik doc

**URL:** <https://community.traefik.io/t/not-clear-about-the-traefik-doc/7521>\
**Category:** Traefik v2\
**Tags:** docker-swarm\
**Created:** [September 3, 2020, 3:40pm UTC](https://community.traefik.io/t/not-clear-about-the-traefik-doc/7521 "2020-09-03T15:40:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gezichenshan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/gezichenshan/32/2517_2.png) [@gezichenshan](https://community.traefik.io/u/gezichenshan)\
**Post date:** [September 3, 2020, 3:40pm UTC](https://community.traefik.io/t/not-clear-about-the-traefik-doc/7521/1 "2020-09-03T15:40:22Z")

</div>

In the docs [https://docs.traefik.io/routing/providers/docker/](https://docs.traefik.io/routing/providers/docker/) it said:

" To update the configuration of the Router automatically attached to the container, add labels starting with `traefik.http.routers.<name-of-your-choice>.` and followed by the option you want to change."

or

" To update the configuration of the Service automatically attached to the container, add labels starting with `traefik.http.services.<name-of-your-choice>.` , followed by the option you want to change."

I want to know, the is arbitrary and you can name whatever you want?

So for a service named foo, we can set the Label in docker compose file like:

`traefik.http.services.foo.loadbalancer.server.port`

`traefik.http.services.bar.loadbalancer.server.port // although I set bar here, it is actually pointed to service foo?`

It puzzles me a lot.

In fact, I don't think the docs was organized in a good understanding way (for a beginner). After a helpful example from Getting Started chapter, a very steep chapter comes with configuration which is really hard to understand is a big obstacle.

Or could you tell me how to use traefik well with some Prerequisites?

---

<div class="post-metadata">

**Author:** ![ldez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/ldez/32/5_2.png) [@ldez](https://community.traefik.io/u/ldez)\
**Post date:** [September 3, 2020, 7:02pm UTC](https://community.traefik.io/t/not-clear-about-the-traefik-doc/7521/2 "2020-09-03T19:02:04Z")

</div>

Hello,

Traefik Services are not Swarm Services.  
`<name-of-your-choice>` is arbitrary.  
Labels are key/value tuple.  
`traefik.http.services.foo.xxx` creates a Traefik Service named `foo`.

so for a container/swarm service:

```auto
services:

  my-app:
    # ...
    deploy:
        labels:
        - "traefik.http.routers.foo.rule=Host(`example.com`)"
        # - "traefik.http.services.bar.loadbalancer.server.port=<the port inside the container>"
        - "traefik.http.services.bar.loadbalancer.server.port=1234
    # ...

```

---

<div class="post-metadata">

**Author:** ![zespri](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/zespri/32/310_2.png) [@zespri](https://community.traefik.io/u/zespri)\
**Post date:** [September 3, 2020, 8:54pm UTC](https://community.traefik.io/t/not-clear-about-the-traefik-doc/7521/3 "2020-09-03T20:54:34Z")

</div>

> [@gezichenshan](#):
>
> traefik.http.services.bar.loadbalancer.server.port // although I set bar here, it is actually pointed to service foo?

if you set `bar` here there is how your traefik service is named. So it is certainly not pointing to another traefic service named `foo`. As ldez explained traefik service is not the same as a swarm service.

> **[Concepts - Traefik](https://doc.traefik.io/traefik/getting-started/concepts/)**
>
> Traefik - base concepts and main features

> **[Traefik Configuration Documentation - Traefik](https://doc.traefik.io/traefik/getting-started/configuration-overview/)**
>
> Get started with Traefik Proxy. This page will introduce you to the dynamic routing and startup configurations. Read the technical documentation.

It sounds like you've already read those above, but I would like to draw your attention to a couple of things you might have missed:

> Traefik gets its _dynamic configuration_ from [providers](https://docs.traefik.io/providers/overview/): whether an orchestrator, a service registry, or a plain old configuration file.

The list of the providers can be found on the side bar under "Configuration Discovery", you will notice that Docker is just one provider of many.

On the other hand the concepts that was explained at the links above, e.g. routers and service, are traefik core concepts, they apply regardless of provider.

From this it follows, that swarm services and their name has nothing to do with traefik services and names, the latter will always be there in any traefik configuration, where the former may or may not be there depending on the provider you are using traefik with.

I hope this help a bit more in understanding this.

---

<div class="post-metadata">

**Author:** ![gezichenshan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/gezichenshan/32/2517_2.png) [@gezichenshan](https://community.traefik.io/u/gezichenshan)\
**Post date:** [September 4, 2020, 7:49am UTC](https://community.traefik.io/t/not-clear-about-the-traefik-doc/7521/4 "2020-09-04T07:49:50Z")

</div>

Much more clear. Thanks. So adding labels to docker swarm service is a docker provider way to defined dynamic traefik configuration, right?

---

<div class="post-metadata">

**Author:** ![zespri](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/zespri/32/310_2.png) [@zespri](https://community.traefik.io/u/zespri)\
**Post date:** [September 6, 2020, 8:32pm UTC](https://community.traefik.io/t/not-clear-about-the-traefik-doc/7521/5 "2020-09-06T20:32:49Z")

</div>

> So adding labels to docker swarm service is a docker provider way to defined dynamic traefik configuration, right?

That's right.
