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: content/reference/compose-file/networks.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -190,6 +190,27 @@ networks:
190
190
external: true
191
191
```
192
192
193
+
#### Accessing host network in Swarm mode with Stack
194
+
If you need to access the Docker host's network when using Swarm mode with `docker stack deploy`,
195
+
you can reference the network by declaring it as an external network:
196
+
197
+
```yml
198
+
services:
199
+
my-service:
200
+
image: example/my-service
201
+
networks:
202
+
- outside
203
+
204
+
networks:
205
+
outside:
206
+
external:
207
+
name: "host"
208
+
```
209
+
> [!NOTE]
210
+
> Accessing the Docker host network adds certain limitations on services including restricted port mapping, lack of service replication, and
211
+
> exclusion from the Swarm's ingress routing mesh and service discovery. For more information, see [External Network Drivers](https://docs.docker.com/engine/network/drivers/host/)
212
+
> and [Swarm mode routing mesh](https://docs.docker.com/engine/swarm/ingress/)
213
+
193
214
### `ipam`
194
215
195
216
`ipam` specifies a custom IPAM configuration. This is an object with several properties, each of which is optional:
0 commit comments