Adding a service
If you followed the Installation correctly, adding services to traefik gets really easy.
Adding docker services with docker compose
To add a docker compose service, simply add the following labels:
services:
bookstack:
labels:
traefik.enable: true
traefik.http.routers.bookstack.rule: Host(`bookstack.${SITE}`)
traefik.http.routers.bookstack.entrypoints: websecure
This will dynamically tell traefik to route the service, no restart of traefik is required. The service will be routed via the websecure
entrypoint (Port 443 with default wildcard certificate).
The service will then be available at https://bookstack.<SITE>
, e.g. https://bookstack.example.com
.
By default, the custom error pages will be used.
If you want your service to only be accessible from your internal network, add the following label aswell:
traefik.http.routers.bookstack.middlewares: secured@file
If your container uses multiple ports, you can specify the correct one for traefik to use by adding the label:
traefik.http.services.<servicename>.loadbalancer.server.port: <PORT>