Add info about network: host (#4959)

This commit is contained in:
Misty Stanley-Jones 2017-10-20 16:17:45 -07:00 committed by GitHub
parent e6f3b11388
commit 2eb70ea3c2
2 changed files with 44 additions and 0 deletions

View File

@ -1418,6 +1418,11 @@ refer to it within the Compose file:
external:
name: actual-name-of-network
#### host or none
Not supposed for version 2 `docker-compose` files. Use
[network_mode](#network_mode) instead.
## Variable substitution
{% include content/compose-var-sub.md %}

View File

@ -1942,6 +1942,45 @@ discovery](https://github.com/docker/labs/blob/master/networking/A3-overlay-netw
networking concepts lab on the [Overlay Driver Network
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
Specify a list of options as key-value pairs to pass to the driver for this