Update ipv6 instructions for 3.x Compose files (#14168)

* Update ipv6 instructions for 3.x Compose files

IPv6 instructions on https://github.com/docker/compose/issues/4958, are compatible with Docker Compose 3.x

* Update code block to use yaml syntax

With @usha-mandya

Co-authored-by: Usha Mandya <47779042+usha-mandya@users.noreply.github.com>

* Update text about using IPv6

By @usha-mandya

Co-authored-by: Usha Mandya <47779042+usha-mandya@users.noreply.github.com>

Co-authored-by: Usha Mandya <47779042+usha-mandya@users.noreply.github.com>
This commit is contained in:
Kayla Reopelle (she/her) 2022-02-04 06:03:19 -08:00 committed by GitHub
parent 4d262d0bf3
commit b730e42610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 2 deletions

View File

@ -1592,8 +1592,18 @@ The corresponding network configuration in the
[top-level networks section](#network-configuration-reference) must have an
`ipam` block with subnet configurations covering each static address.
> If IPv6 addressing is desired, the [`enable_ipv6`](compose-file-v2.md#enable_ipv6)
> option must be set, and you must use a [version 2.x Compose file](compose-file-v2.md#ipv4_address-ipv6_address).
If you'd like to use IPv6, you must first ensure that the Docker daemon is configured to support IPv6. See [Enable IPv6](../../config/daemon/ipv6.md) for detailed instructions. You can then access IPv6 addressing in a version 3.x Compose file by editing the `/etc/docker/daemon.json` to contain:
`{"ipv6": true, "fixed-cidr-v6": "2001:db8:1::/64"}`
Then, reload the docker daemon and edit docker-compose.yml to contain the following under the service:
```yaml
sysctls:
- net.ipv6.conf.all.disable_ipv6=0
```
> The [`enable_ipv6`](compose-file-v2.md#enable_ipv6)
> option is only available in a [version 2.x Compose file](compose-file-v2.md#ipv4_address-ipv6_address).
> _IPv6 options do not currently work in swarm mode_.
An example: