Dynamic file configuration as docker config provider

Hi traefikers !

I created this feature request under github (auto-closed).

The goal would be to get ride of all traefik labels in my docker-compose.yaml, and load all the traefik/container config from dynamic configuration system.

Why ? Today if I want to change a running container configuration concerning Traefik, I have to change traefik labels and restart this container. What I don't want. So dynamic file configuration would be more comfortable to do this.

Is it already possible to link dynamic config file and containers at the moment or am I blind ?

Cheers !

Hello,

it's possible to reference an element from a provider to another by using the provider namespace syntax: xx@file xxx@docker

Thanks @ldez for your help and your answers on github & community forum !

So I tried the very minimal of what I would like as configuration (example below with privatebin) :

# docker-compose.yaml
version: '3.4'
services:
  privatebin:
    ...
    container_name: "privatebin"
    expose:
      - '80'
    labels:
      - traefik.enable=true
      - traefik.http.services.privatebin.loadbalancer.server.port=80
      # OK to describe the port here, it makes sense.
      # nothing else should be described here
    volumes:
    ...
# dynamic/privatebin.yaml
http:
  routers:
    to-privatebin:
      rule: "Host(`privatebin.mydomain.io`)"
      service: privatebin-trunk@docker
      entryPoints:  
        - https

Ok it works but I also have default routers auto provided by Traefik, like the screenshot below.
What I just don't want to.

for now, we don't have a way to disable the automatic router and service creation.

You can follow https://github.com/containous/traefik/issues/5576


A quick note:

The main goal of Traefik is to manage dynamic architecture:

  • a container appears, Traefik detect it and create the configuration (based on labels)
  • a container disappears, Traefik detect it and remove the configuration

The file provider breaks this dynamic behavior.

The file provider, for the routing, has been introduced for only old architecture (VMs, bare metal servers, ...)

So we recommend to not using it to define the routing.

:thinking: it makes sense.

To another hand, configuration based on labels restrict to restart all your running containers for a pure Traefik logic modification.