From 121eaced490f5cef4ab1ffba0d00a9cb0ef50d3c Mon Sep 17 00:00:00 2001 From: Kevin Crawley <3759919+notsureifkevin@users.noreply.github.com> Date: Thu, 3 Dec 2020 02:36:03 -0600 Subject: [PATCH] Add example for multiple service per container --- docs/content/routing/providers/docker.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/content/routing/providers/docker.md b/docs/content/routing/providers/docker.md index 6cc0cf2a8..d3af40057 100644 --- a/docs/content/routing/providers/docker.md +++ b/docs/content/routing/providers/docker.md @@ -58,6 +58,26 @@ Attach labels to your containers and let Traefik do the rest! Setting the label `traefik.http.services.xxx.loadbalancer.server.port` overrides that behavior. +??? example "Specifying more than one router and service per container" + + Forwarding requests to more than one port on a container requires referencing the service loadbalancer port definition using the service parameter on the router. + + In this example, requests are forwarded for `http://example-a.com` to `http://:8000` in addition to `http://example-b.com` forwarding to `http://:9000`: + + ```yaml + version: "3" + services: + my-container: + # ... + labels: + - traefik.http.routers.www-router.rule=Host(`example-a.com`) + - traefik.http.routers.www-router.service=www-service + - traefik.http.services.www-service.loadbalancer.server.port=8000 + - traefik.http.routers.admin-router.rule=Host(`example-b.com`) + - traefik.http.routers.admin-router.service=admin-service + - traefik.http.services.admin-service.loadbalancer.server.port=9000 + ``` + ??? example "Configuring Docker Swarm & Deploying / Exposing Services" Enabling the docker provider (Swarm Mode)