Label alternative

I have a case where I can't modify my docker containers run / compose command so I am unable to add labels for Traefik the "normal" way.

Questions is - can I somehow add these labels in my Traefik config.toml file - or some alternativ.
I am using Traefik 2.4.7

My labels I wanted to add to my container is:

        - "traefik.enable=true"
        - "traefik.http.routers.homeassistant.rule=Host(``)"
        - "traefik.http.routers.homeassistant.entrypoints=websecure"
        - "traefik.http.routers.homeassistant.tls=true"
        - ""
        - "traefik.http.routers.homeassistant.service=homeassistant"

The labels are part of the dynamic configuration so you can try to execute an imperative command docker service update <service-name> --label-add

I haven't tested that, so you can try it. Let us know :wink:

Based on the errors I get from that, it seems thats only for a Swarm

@jakubhajek - isn't there are way that only includes doing the change in the Traefik configuration?

You can try to create the dynamic configuration according to this example:

and try to point the server to the Homassistant port if it is reachable / exposed.

However, I've not tested that kind of setup.

The recommended solution is to use labels on a service level but I understand that there is no way to restart the running container.


I gave it a try - but is seems that I just get a 404

entryPoints = ["websecure", "web"]
middlewares = ["https-redirect", "security-headers"]
service = "homeassistant"
rule = "Host("
#certResolver = "le"
options = "default"

                url = "http://localhost:8123"

Any new ideas on what to do ?