Docker IPV6

My website was in IPV4 only state until lately. Docker network rely on IPV4 adresses and I’ve tried many options to get IPV6 working with Docker. I’ve now found a solution, similarly to the way it handles IPV4 I use nat with ipv6nat. First step enable IPV6 on docker :

#/etc/docker/daemon.json

{
  "ipv6": true,
  "fixed-cidr-v6": "fd00:dead:beef::/48",
  "log-driver": "local",
  "log-opts": {
    "max-size": "15m",
    "max-file": "5"
  }
}
  

IPV6 is set to true and I’ve set a fixed ipv6 local network for my containers. My container have now an IPV6 local adress, if i type ip addr list I’ll see a lot of ipv6 networks. To enable my container an access to the outside world I’ll now enable the nat.

docker run -d --name ipv6nat --privileged --network host --restart unless-stopped -v /var/run/docker.sock:/var/run/docker.sock:ro -v /lib/modules:/lib/modules:ro robbertkl/ipv6nat

Now everything is routed to my ipv6 server adress the same way that ipv4 is working in Docker.


.