Treafik v2 + multirouters + HostRegexp

  docker, routes, traefik

Just leaving it here for those whose trying to solve same issue

Gitlab, Registry, Pages example

  labels:
    - traefik.enable=true
    # Gitlab
    - traefik.http.routers.gitlab.tls=true
    - traefik.http.routers.gitlab.rule=Host(`gitlab.mycompany.local`)
    - traefik.http.routers.gitlab.priority=2
    - traefik.http.routers.gitlab.service=gitlab-service
    - traefik.http.services.gitlab-service.loadbalancer.server.port=80
    # Registry
    - traefik.http.routers.registry.tls=true
    - traefik.http.routers.registry.rule=Host(`registry.mycompany.local`)
    - traefik.http.routers.registry.priority=2
    - traefik.http.routers.registry.service=registry-service
    - traefik.http.services.registry-service.loadbalancer.server.port=5001
    # Pages
    - traefik.http.routers.pages.tls=true
    - traefik.http.routers.pages.rule=HostRegexp(`mycompany.local`,`{subhost:[a-zA-Z0-9-]+}.mycompany.local`)
    - traefik.http.routers.pages.priority=1
    - traefik.http.routers.pages.service=pages-service
    - traefik.http.services.pages-service.loadbalancer.server.port=5002

Source: Docker Questions

LEAVE A COMMENT