Use IPv6 networking
IPv6 is only supported on Docker daemons running on Linux hosts.
Create an IPv6 network
-
Using
docker network create
:$ docker network create --ipv6 ip6net
-
Using
docker network create
, specifying an IPv6 subnet:$ docker network create --ipv6 --subnet 2001:db8::/64 ip6net
-
Using a Docker Compose file:
networks: ip6net: enable_ipv6: true ipam: config: - subnet: 2001:db8::/64
You can now run containers that attach to the
ip6net
network.
$ 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:
$ 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: */*
Use IPv6 for the default bridge network
The following steps show you how to use IPv6 on the default bridge network.
-
Edit the Docker daemon configuration file, located at
/etc/docker/daemon.json
. Configure the following parameters: