Browse documentation
Labels & discovery
Keep routing close to the application it belongs to.
Two labels to discover a route
Set dr.enable to true and provide dr.host. By default, DockRouter detects the backend port. Set dr.port explicitly when the container exposes multiple ports or you want a different target.
labels:
dr.enable: "true"
dr.host: "api.example.com"
dr.port: "8080"
dr.tls: "auto"Route by hostname and path
Use dr.path for a path prefix and dr.priority to resolve route precedence. Higher priorities win. The prefix can be stripped or added through middleware labels.
labels:
dr.enable: "true"
dr.host: "example.com"
dr.path: "/api"
dr.priority: "10"
dr.stripprefix: "/api"Routes follow container lifecycle
Docker discovery updates the router when containers start or stop. Enabled replicas are collected in backend pools. Your router and target containers need network connectivity; labels do not create Docker networks.
Routing label reference
Optional routing labels let you override the defaults on each service.
| Label | Purpose | Default |
|---|---|---|
| dr.enable | Discover this container | Required |
| dr.host | Incoming hostname | Required |
| dr.port | Backend port | Auto-detected |
| dr.path | Path prefix | / |
| dr.priority | Route precedence | 0 |
| dr.address | Explicit backend address | Auto |
| dr.loadbalancer | Backend selection policy | roundrobin |
| dr.weight | Weighted backend preference | 1 |