mirror of https://github.com/docker/docs.git
parent
d49a5027e8
commit
a0b3a20b96
|
@ -105,9 +105,28 @@ networks:
|
|||
attachable: true
|
||||
```
|
||||
|
||||
### `enable_ipv4`
|
||||
|
||||
{{< summary-bar feature_name="Compose enable ipv4" >}}
|
||||
|
||||
`enable_ipv4` can be used to disable IPv4 address assignment.
|
||||
|
||||
```yml
|
||||
networks:
|
||||
ip6net:
|
||||
enable_ipv4: false
|
||||
enable_ipv6: true
|
||||
```
|
||||
|
||||
### `enable_ipv6`
|
||||
|
||||
`enable_ipv6` enables IPv6 networking. For an example, see step four of [Create an IPv6 network](/manuals/engine/daemon/ipv6.md).
|
||||
`enable_ipv6` enables IPv6 address assignment.
|
||||
|
||||
```yml
|
||||
networks:
|
||||
ip6net:
|
||||
enable_ipv6: true
|
||||
```
|
||||
|
||||
### `external`
|
||||
|
||||
|
|
|
@ -1425,12 +1425,46 @@ networks:
|
|||
|
||||
`mac_address` sets the Mac address used by the service container when connecting to this particular network.
|
||||
|
||||
#### `gw_priority`
|
||||
|
||||
{{< summary-bar feature_name="Compose gw priority" >}}
|
||||
|
||||
The network with the highest `gw_priority` is selected as the default gateway for the service container.
|
||||
If unspecified, the default value is 0.
|
||||
|
||||
In the following example, `app_net_2` will be selected as the default gateway.
|
||||
|
||||
```yaml
|
||||
services:
|
||||
app:
|
||||
image: busybox
|
||||
command: top
|
||||
networks:
|
||||
app_net_1:
|
||||
app_net_2:
|
||||
gw_priority: 1
|
||||
app_net_3:
|
||||
networks:
|
||||
app_net_1:
|
||||
app_net_2:
|
||||
app_net_3:
|
||||
```
|
||||
|
||||
#### `priority`
|
||||
|
||||
`priority` indicates in which order Compose connects the service’s containers to its
|
||||
networks. If unspecified, the default value is 0.
|
||||
|
||||
In the following example, the app service connects to `app_net_1` first as it has the highest priority. It then connects to `app_net_3`, then `app_net_2`, which uses the default priority value of 0.
|
||||
If the container runtime accepts a `mac_address` attribute at service level, it is
|
||||
applied to the network with the highest `priority`. In other cases, use attribute
|
||||
`networks.mac_address`.
|
||||
|
||||
`priority` does not affect which network is selected as the default gateway. Use the
|
||||
[`gw_priority`](#gw_priority) attribute instead.
|
||||
|
||||
`priority` does not control the order in which networks connections are added to
|
||||
the container, it cannot be used to determine the device name (`eth0` etc.) in the
|
||||
container.
|
||||
|
||||
```yaml
|
||||
services:
|
||||
|
|
|
@ -80,12 +80,16 @@ Compose exec:
|
|||
requires: Docker Compose [2.32.2](/manuals/compose/releases/release-notes.md#2232) and later
|
||||
Compose experimental:
|
||||
requires: Docker Compose [2.26.0](/manuals/compose/releases/release-notes.md#2260) and later
|
||||
Compose enable ipv4:
|
||||
requires: Docker Compose [2.33.1](/manuals/compose/releases/release-notes.md#2331) and later
|
||||
Compose file watch:
|
||||
requires: Docker Compose [2.22.0](/manuals/compose/releases/release-notes.md#2220) and later
|
||||
Compose format:
|
||||
requires: Docker Compose [2.30.0](/manuals/compose/releases/release-notes.md#2300) and later
|
||||
Compose gpus:
|
||||
requires: Docker Compose [2.30.0](/manuals/compose/releases/release-notes.md#2300) and later
|
||||
Compose gw priority:
|
||||
requires: Docker Compose [2.33.1](/manuals/compose/releases/release-notes.md#2331) and later
|
||||
Compose include:
|
||||
requires: Docker Compose [2.20.3](/manuals/compose/releases/release-notes.md#2203) and later
|
||||
Compose label file:
|
||||
|
|
Loading…
Reference in New Issue