Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions compose/compose-file/compose-file-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,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 %}
Expand Down
39 changes: 39 additions & 0 deletions compose/compose-file/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down