mirror of https://github.com/docker/docs.git
parent
a5fe1766f5
commit
21f9086699
|
@ -70,46 +70,10 @@ driver is not available on the platform.
|
||||||
```yml
|
```yml
|
||||||
networks:
|
networks:
|
||||||
db-data:
|
db-data:
|
||||||
driver: overlay
|
driver: bridge
|
||||||
```
|
```
|
||||||
|
|
||||||
Compose supports the following drivers:
|
For more information on drivers and available options, see [Network drivers](../../network/drivers/_index.md).
|
||||||
`none` and `host`
|
|
||||||
|
|
||||||
- `host`: Use the host's networking stack.
|
|
||||||
- `none`: Turn off networking.
|
|
||||||
|
|
||||||
#### host or none
|
|
||||||
|
|
||||||
The syntax for using built-in networks such as `host` and `none` is different, as such networks implicitly exist outside
|
|
||||||
the scope of Compose. To use them, you must define an external network with the name `host` or `none` and
|
|
||||||
an alias that Compose can use (`hostnet` and `nonet` in the following example), then grant the service
|
|
||||||
access to that network using its alias.
|
|
||||||
|
|
||||||
```yml
|
|
||||||
services:
|
|
||||||
web:
|
|
||||||
networks:
|
|
||||||
hostnet: {}
|
|
||||||
|
|
||||||
networks:
|
|
||||||
hostnet:
|
|
||||||
external: true
|
|
||||||
name: host
|
|
||||||
```
|
|
||||||
|
|
||||||
```yml
|
|
||||||
services:
|
|
||||||
web:
|
|
||||||
...
|
|
||||||
networks:
|
|
||||||
nonet: {}
|
|
||||||
|
|
||||||
networks:
|
|
||||||
nonet:
|
|
||||||
external: true
|
|
||||||
name: none
|
|
||||||
```
|
|
||||||
|
|
||||||
### driver_opts
|
### driver_opts
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue