Skip to content

Commit a0b3a20

Browse files
authored
Merge pull request #22089 from aevesdocker/ENGDOCS-2437
ENGDOCS-2437
1 parent d49a502 commit a0b3a20

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

content/reference/compose-file/networks.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,28 @@ networks:
105105
attachable: true
106106
```
107107

108+
### `enable_ipv4`
109+
110+
{{< summary-bar feature_name="Compose enable ipv4" >}}
111+
112+
`enable_ipv4` can be used to disable IPv4 address assignment.
113+
114+
```yml
115+
networks:
116+
ip6net:
117+
enable_ipv4: false
118+
enable_ipv6: true
119+
```
120+
108121
### `enable_ipv6`
109122

110-
`enable_ipv6` enables IPv6 networking. For an example, see step four of [Create an IPv6 network](/manuals/engine/daemon/ipv6.md).
123+
`enable_ipv6` enables IPv6 address assignment.
124+
125+
```yml
126+
networks:
127+
ip6net:
128+
enable_ipv6: true
129+
```
111130

112131
### `external`
113132

content/reference/compose-file/services.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,12 +1425,46 @@ networks:
14251425

14261426
`mac_address` sets the Mac address used by the service container when connecting to this particular network.
14271427

1428+
#### `gw_priority`
1429+
1430+
{{< summary-bar feature_name="Compose gw priority" >}}
1431+
1432+
The network with the highest `gw_priority` is selected as the default gateway for the service container.
1433+
If unspecified, the default value is 0.
1434+
1435+
In the following example, `app_net_2` will be selected as the default gateway.
1436+
1437+
```yaml
1438+
services:
1439+
app:
1440+
image: busybox
1441+
command: top
1442+
networks:
1443+
app_net_1:
1444+
app_net_2:
1445+
gw_priority: 1
1446+
app_net_3:
1447+
networks:
1448+
app_net_1:
1449+
app_net_2:
1450+
app_net_3:
1451+
```
1452+
14281453
#### `priority`
14291454

14301455
`priority` indicates in which order Compose connects the service’s containers to its
14311456
networks. If unspecified, the default value is 0.
14321457

1433-
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.
1458+
If the container runtime accepts a `mac_address` attribute at service level, it is
1459+
applied to the network with the highest `priority`. In other cases, use attribute
1460+
`networks.mac_address`.
1461+
1462+
`priority` does not affect which network is selected as the default gateway. Use the
1463+
[`gw_priority`](#gw_priority) attribute instead.
1464+
1465+
`priority` does not control the order in which networks connections are added to
1466+
the container, it cannot be used to determine the device name (`eth0` etc.) in the
1467+
container.
14341468

14351469
```yaml
14361470
services:

data/summary.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,16 @@ Compose exec:
8080
requires: Docker Compose [2.32.2](/manuals/compose/releases/release-notes.md#2232) and later
8181
Compose experimental:
8282
requires: Docker Compose [2.26.0](/manuals/compose/releases/release-notes.md#2260) and later
83+
Compose enable ipv4:
84+
requires: Docker Compose [2.33.1](/manuals/compose/releases/release-notes.md#2331) and later
8385
Compose file watch:
8486
requires: Docker Compose [2.22.0](/manuals/compose/releases/release-notes.md#2220) and later
8587
Compose format:
8688
requires: Docker Compose [2.30.0](/manuals/compose/releases/release-notes.md#2300) and later
8789
Compose gpus:
8890
requires: Docker Compose [2.30.0](/manuals/compose/releases/release-notes.md#2300) and later
91+
Compose gw priority:
92+
requires: Docker Compose [2.33.1](/manuals/compose/releases/release-notes.md#2331) and later
8993
Compose include:
9094
requires: Docker Compose [2.20.3](/manuals/compose/releases/release-notes.md#2203) and later
9195
Compose label file:

0 commit comments

Comments
 (0)