mirror of https://github.com/docker/docs.git
Add info about network: host (#4959)
This commit is contained in:
parent
e6f3b11388
commit
2eb70ea3c2
|
@ -1418,6 +1418,11 @@ refer to it within the Compose file:
|
||||||
external:
|
external:
|
||||||
name: actual-name-of-network
|
name: actual-name-of-network
|
||||||
|
|
||||||
|
#### host or none
|
||||||
|
|
||||||
|
Not supposed for version 2 `docker-compose` files. Use
|
||||||
|
[network_mode](#network_mode) instead.
|
||||||
|
|
||||||
## Variable substitution
|
## Variable substitution
|
||||||
|
|
||||||
{% include content/compose-var-sub.md %}
|
{% include content/compose-var-sub.md %}
|
||||||
|
|
|
@ -1942,6 +1942,45 @@ discovery](https://github.com/docker/labs/blob/master/networking/A3-overlay-netw
|
||||||
networking concepts lab on the [Overlay Driver Network
|
networking concepts lab on the [Overlay Driver Network
|
||||||
Architecture](https://github.com/docker/labs/blob/master/networking/concepts/06-overlay-networks.md).
|
Architecture](https://github.com/docker/labs/blob/master/networking/concepts/06-overlay-networks.md).
|
||||||
|
|
||||||
|
#### host or none
|
||||||
|
|
||||||
|
Use the host's networking stack, or no networking. Equivalent to
|
||||||
|
`docker run --net=host` or `docker run --net=none`. Only used if you use
|
||||||
|
`docker stack` commands. If you use the `docker-compose` command,
|
||||||
|
use [network_mode](#network_mode) instead.
|
||||||
|
|
||||||
|
The syntax for using built-in networks like `host` and `none` is a little
|
||||||
|
different. Define an external network with the name `host` or `none` (which
|
||||||
|
Docker has already created automatically) and an alias that Compose can use
|
||||||
|
(`hostnet` or `nonet` in these examples), then grant the service access to that
|
||||||
|
network, using the alias.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
...
|
||||||
|
networks:
|
||||||
|
hostnet: {}
|
||||||
|
|
||||||
|
networks:
|
||||||
|
hostnet:
|
||||||
|
external:
|
||||||
|
name: host
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
...
|
||||||
|
networks:
|
||||||
|
nonet: {}
|
||||||
|
|
||||||
|
networks:
|
||||||
|
nonet:
|
||||||
|
external:
|
||||||
|
name: none
|
||||||
|
```
|
||||||
|
|
||||||
### driver_opts
|
### driver_opts
|
||||||
|
|
||||||
Specify a list of options as key-value pairs to pass to the driver for this
|
Specify a list of options as key-value pairs to pass to the driver for this
|
||||||
|
|
Loading…
Reference in New Issue