Skip to main content

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

FieldDescriptionDefault
pingAddrAddress (host:port) for the /livez and /readyz health endpoints.:8081

swarm options

FieldDescriptionDefault
swarm.endpointDocker API endpoint.unix:///var/run/docker.sock
swarm.gatewayLabelSwarm service label (key=value) identifying the Hub gateway service.io.traefik.hub.component=gateway
swarm.networkDefault overlay network; always attached to the gateway when set, regardless of service labels.(none)
swarm.exposedByDefaultWhen true, services without traefik.enable are also considered.true
swarm.resyncIntervalInterval between full reconcile passes that catch any missed events.30s
swarm.detachDebounceHow 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 labeled io.traefik.hub.component, regardless of value). This applies independently of traefik.swarm.network labels on user services.
  • The swarm.network default, 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