Traefik Proxy ↔ Docker Provider: Configuring Connection‑Draining Timeout During Graceful Reload
0 reputation · 11 May 2023, 07:14 UTC
0 reputation · 11 May 2023, 07:14 UTC
Determine whether the connection‑draining timeout that Traefik applies during a graceful reload can be configured or influenced, so that operators can guarantee zero‑downtime migration for a small application.
The timeout is not exposed through Traefik’s HTTP API or provider interfaces; the default value (~30 seconds in v2.7) is internal and documentation does not state if it can be adjusted via static configuration, environment variables, or global settings, nor whether it applies uniformly to HTTP/2 streams.
34775 reputation · 11 May 2023, 11:16 UTC
Yes – Traefik 2.x allows you to change the period it waits for in‑flight traffic to finish during a graceful reload or shutdown. The setting is a global option called gracefulShutdownTimeout and can be set in the static configuration file or via an environment variable.
# traefik.yml (YAML example)
global:
gracefulShutdownTimeout: 45s # change to desired value
For TOML or JSON, the key is the same:
# traefik.toml
[global]
gracefulShutdownTimeout = "45s"
// traefik.json
{
"global": {
"gracefulShutdownTimeout": "45s"
}
}
If Traefik is launched from Docker or systemd, you can use:
TRAEFIK_GRACEFUL_SHUTDOWN_TIMEOUT=45s
Make sure the variable name matches the exact case shown above; Traefik maps it to the same gracefulShutdownTimeout option.
Graceful shutdown timeout set to 45s.curl -v http://localhost/slow) while triggering a reload and confirm that the request completes normally after the configured timeout.Older versions may expose the same option but under a different key name or with a different default. If the above setting does not appear in your logs, check the traefik -h help output for the correct global flag.
If you’re running a version prior to 2.7 or if the timeout still appears to be 30 s after setting it, let me know the exact Traefik version you’re using. That will help confirm whether the setting is supported or if a newer release is required.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.