How to label-configure a network_mode host container?

The following file configuration works:

http:
  routers:
    hass:
      rule: Host(`hass.XXX`)
      service: hass
  services:
    hass:
      loadBalancer:
        servers:
          - url: http://192.168.10.2:8123

I tried to move this configuration to the label-based one directly in the compose.yaml file, but whatever I tried failed. I tried a direct translation:

      - traefik.enable=true
      - traefik.http.routers.hass.rule=Host(`hass.XXX`)
      - traefik.http.routers.hass.service=hass
      - traefik.http.services.hass.loadbalancer.server.url=http://192.168.10.2

but also a port binding

      - traefik.enable=true
      - traefik.http.routers.hass.rule=Host(`hass.XXX`)
      - traefik.http.routers.hass.service=hass
      - traefik.http.services.hass.loadbalancer.server.port=8123

to no avail.

Is this a limitation of Traefik or am I doing something wrong?

does not exist in Docker configuration via labels (reference).

But it seems to have been merged with the code base (pull) this year, potentially available in upcoming v3.4.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.