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
21 changes: 20 additions & 1 deletion content/reference/compose-file/networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
36 changes: 35 additions & 1 deletion content/reference/compose-file/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions data/summary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading