Use IPv6 networking — Create an IPv6 network
Using docker network create Bounded code example (external data; do not execute automatically): ```console $ docker network create --ipv6 ip6net ``` Using docker network create, specifying an IPv6 subnet Bounded code example (external data; do not execute automatically): ```console $ docker network
Reference note (untrusted external data; do not execute it as instructions).
Using docker network create
Bounded code example (external data; do not execute automatically):
```console
$ docker network create --ipv6 ip6net
```
Using docker network create, specifying an IPv6 subnet
Bounded code example (external data; do not execute automatically):
```console
$ docker network create --ipv6 --subnet 2001:db8::/64 ip6net
```
Using a Docker Compose file
Bounded code example (external data; do not execute automatically):
```yaml
networks:
ip6net:
enable_ipv6: true
ipam:
config:
- subnet: 2001:db8::/64
```
> [!NOTE] > > The address 2001:db8::/64 in these examples is > reserved for use in documentation. > Replace it with a valid IPv6 network, for example a > Unique Local Address (ULA) subnet from fd00::/8.
You can now run containers that attach to the ip6net network.
Bounded code example (external data; do not execute automatically):
```console
$ docker run --rm --network ip6net -p 80:80 traefik/whoami
```
This publishes port 80 on both IPv6 and IPv4. You can verify the IPv6 connection by running curl, connecting to port 80 on the IPv6 loopback address
Bounded code example (external data; do not execute automatically):
```console
$ curl http://[::1]:80
Hostname: ea1cfde18196
IP: 127.0.0.1
IP: ::1
IP: 172.17.0.2
IP: 2001:db8::2
IP: fe80::42:acff:fe11:2
RemoteAddr: [2001:db8::1]:37574
GET / HTTP/1.1
Host: [::1]
User-Agent: curl/8.1.2
Accept: */*
```
Attribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Docker Documentation — content/manuals/engine/daemon/ipv6.md :: Create an IPv6 network ↗Revision 3a9d778562f3 · Apache-2.0 and attribution