You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ Control the default behavior of `nginx-proxy`:
85
85
|`NGINX_WORKER_CONNECTIONS`|`65535`| Max connections per worker. |
86
86
|`CERT_RENEW_THRESHOLD_DAYS`|`30`| By default certificates are renewed when they have <=30 days remaining. |
87
87
|`ENABLE_IPV6`|`false`| Enable IPv6 support on nginx. |
88
-
|`DOCKER_SWARM`|`ignore`| Controls Docker Swarm discovery. Supported values are `ignore`, `exclude`, `enable`, and `strict`; see [Docker Swarm Support](#docker-swarm-support-preview). |
88
+
|`DOCKER_SWARM`|`ignore`| Controls Docker Swarm discovery. Supported values are `ignore`, `exclude`, `enable`, `prefer-local`, and `strict`; see [Docker Swarm Support](#docker-swarm-support-preview). |
89
89
|`SWARM_DOCKER_HOST`| - | URL of the Swarm manager socket (e.g., `tcp://manager:2375`). |
90
90
|`CERTAPI_URL`| - | External Certificate API URL. |
91
91
|`CERTAPI_BATCH_DOMAINS`|`true`| When using `CERTAPI_URL`, request safe domain batching (`batch_domains=true`) to avoid recursive domain-order errors. |
@@ -150,6 +150,7 @@ Docker Swarm discovery is controlled by the `DOCKER_SWARM` environment variable
150
150
|`ignore`| Included | Not discovered | Default Docker-only behavior. Swarm task containers are treated like standalone containers if they are visible on the local Docker socket. |
151
151
|`exclude`| Included | Not discovered | Docker-only discovery while explicitly ignoring containers that belong to Swarm services. |
152
152
|`enable`| Included | Included | Mixed mode. Use this when `nginx-proxy` should route both standalone containers and Swarm services. |
153
+
|`prefer-local`| Included | Included | Mixed Swarm mode that prefers healthy local task containers and keeps the service VIP as a fallback. |
153
154
|`strict`| Excluded | Included | Swarm-only mode. Use this when `nginx-proxy` should route only Swarm services. |
154
155
155
156
`ignore` is the default and does not require the Docker node to be in Swarm mode. In this mode, `nginx-proxy` only reads the normal Docker container API. If a Swarm task container is visible on the local Docker socket, it can be registered as if it were a regular container.
@@ -158,9 +159,11 @@ Docker Swarm discovery is controlled by the `DOCKER_SWARM` environment variable
158
159
159
160
`enable` reads both local containers and Swarm services. Standalone containers are discovered from the local Docker socket. Swarm services are discovered from the Swarm manager API, and task containers are skipped so each service is registered once.
160
161
162
+
`prefer-local` reads both local containers and Swarm services, but local Swarm task containers are also discovered from the local Docker socket. When a route has local containers and the Swarm service VIP, nginx sends normal traffic to the local containers and marks the service VIP as a `backup` upstream server. If no local container is available, the service VIP is used normally. Existing container healthcheck and `BACKEND_START_GRACE_SECONDS` behavior still applies before local containers are registered.
163
+
161
164
`strict` reads only Swarm services. Local standalone containers are ignored, and Swarm task containers are also ignored. This is the mode to use when this proxy instance is dedicated to Swarm routing.
162
165
163
-
For `enable` and `strict`, the Swarm API client must be connected to a manager node because Docker only allows managers to list services. If `nginx-proxy` is running on a worker node, set `SWARM_DOCKER_HOST` to a reachable manager Docker API endpoint:
166
+
For `enable`, `prefer-local`, and `strict`, the Swarm API client must be connected to a manager node because Docker only allows managers to list services. If `nginx-proxy` is running on a worker node, set `SWARM_DOCKER_HOST` to a reachable manager Docker API endpoint:
0 commit comments