编辑文件daemon.json

vi /etc/docker/daemon.json
{
  "ipv6": true,
  "fixed-cidr-v6": "fd00::/80",
  "experimental": true,
  "ip6tables": true
}

ipv6 设置为true,启用对ipv6的支持

fixed-cidr-v6 配置ipv6子网

ip6tables 启用ip6tablesdocker会在ip6tables中配置docker网络相关的规则链

experimental 启用实验特性,ip6tablesdocker的一个实验功能,所以需要设为true,不然ip6tables不生效

重启docker

systemctl restart docker