Swarm Network Auto-Discovery Configuration
Early Access
Swarm network auto-discovery is currently in early access. Available starting v3.21.0-ea.3.
Configuration reference for the swarm-network-autodiscovery side service. For
the setup procedure, see
Enable Swarm Network Auto-Discovery.
Configuration is accepted as CLI flags, environment variables, or a YAML/TOML
file (pass --configFile=<path>).
Side service options
| Field | Description | Default |
|---|---|---|
pingAddr | Address (host:port) for the /livez and /readyz health endpoints. | :8081 |
swarm options
| Field | Description | Default |
|---|---|---|
swarm.endpoint | Docker API endpoint. | unix:///var/run/docker.sock |
swarm.gatewayLabel | Swarm service label (key=value) identifying the Hub gateway service. | io.traefik.hub.component=gateway |
swarm.network | Default overlay network; always attached to the gateway when set, regardless of service labels. | (none) |
swarm.exposedByDefault | When true, services without traefik.enable are also considered. | true |
swarm.resyncInterval | Interval between full reconcile passes that catch any missed events. | 30s |
swarm.detachDebounce | How long the side service waits after a network loses all labeled services before detaching the gateway. | 5s |
Networks the gateway is always attached to
Two kinds of networks are never removed by reconciliation, even after every labeled service on them is gone:
- Any overlay network that carries the label key configured in
swarm.gatewayLabel(by default, any network labeledio.traefik.hub.component, regardless of value). This applies independently oftraefik.swarm.networklabels on user services. - The
swarm.networkdefault, when set.
If the gateway stays attached to a network you expected it to leave, check
whether that network carries the gateway label key. Unset swarm.network if
it points there instead.
Example configuration file
swarm-network-autodiscovery.yml
pingAddr: ":8081"
swarm:
endpoint: "unix:///var/run/docker.sock"
gatewayLabel: "io.traefik.hub.component=gateway"
resyncInterval: "30s"
detachDebounce: "10s"
exposedByDefault: false
Start with the file:
traefik-hub swarm-network-autodiscovery \
--configFile=/etc/traefik-hub/swarm-network-autodiscovery.yml
Related content
- Enable Swarm Network Auto-Discovery
- Read the Docker installation documentation.
