Enable IPv6 on Docker Bridge Networks: Step‑by‑Step Guide
This tutorial shows how to activate IPv6 support for Docker bridge networks by obtaining a public IPv6 block, dividing it into subnets, configuring the Docker daemon, restarting the service, and optionally setting up IPv6 in Docker Compose, with full code examples.
Docker does not enable IPv6 by default, but many workloads require it. This article explains how to enable IPv6 support on Docker bridge networks, assuming you have a public IPv6 address block.
First, obtain your IPv6 address from the host provider or by running ip -f inet6 addr show eth0. The global‑scoped address (e.g., 2607:f0d0:1002:51::4/64) is the one to use.
1. IPv6 Subnet Division
Similar to IPv4 private subnets, you can divide your IPv6 block into multiple subnets. Use an IPv6 Subnetting Calculator to split, for example, into four /66 subnets:
2607:f0d0:1002:51::/66
2607:f0d0:1002:51:4000::/66
2607:f0d0:1002:51:8000::/66
2607:f0d0:1002:51:c000::/662. Configure Docker Daemon for IPv6
Edit (or create) /etc/docker/daemon.json and add the following entries, adjusting the subnet to match your first /66 block:
{
"experimental": true,
"ipv6": true,
"ip6tables": true,
"fixed-cidr-v6": "2607:f0d0:1002:51::/66"
}If you prefer to manage firewall rules yourself, set "ip6tables": false or remove the key. After saving, restart Docker: systemctl restart docker Docker now has IPv6 support.
3. Optional: Enable IPv6 in Docker Compose
When using Docker Compose, define the network with IPv6 enabled and a different subnet than the daemon configuration:
networks:
example:
enable_ipv6: true
driver: bridge
driver_opts:
com.docker.network.enable_ipv6: "true"
ipam:
config:
- subnet: 172.23.0.0/16
- subnet: "2607:f0d0:1002:51:4000::/66"
gateway: 2607:f0d0:1002:51:4000::1Adjust the IPv6 subnet and gateway to suit your environment.
Reference
https://docs.docker.com/config/daemon/ipv6/
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
