My host has ipv6 which works fine. But my containers cant connect out on ipv6.

Docker version 18.03.1-ce, build 9ee9f40

/etc/network/interfaces (host)

iface eth0 inet6 static
address 2001:xxxx:5000:20::0010
netmask 64
gateway 2001:xxxx:5000:20::1


    "ipv6": true,
    "fixed-cidr-v6": "2001:xxxx:5000:20::/64",
    "default-gateway-v6": "2001:xxxx:5000:20::1"

sysctl (host)

net.ipv6.conf.default.forwarding = 1

docker run -it alpine ash -c "ip -6 addr show dev eth0; ip -6 route show; ping6 google.com"

259: eth0@if260: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 state UP 
    inet6 2001:xxxx:5000:20::242:ac11:2/64 scope global flags 02 
       valid_lft forever preferred_lft forever
    inet6 fe80::42:acff:fe11:2/64 scope link tentative 
       valid_lft forever preferred_lft forever

2001:xxxx:5000:20::/64 dev eth0  metric 256 
fe80::/64 dev eth0  metric 256 
default via 2001:xxxx:5000:20::1 dev eth0  metric 1024 
ff00::/8 dev eth0  metric 256 

PING google.com (2a00:1450:4009:801::200e): 56 data bytes

Ping just hangs


Try passing --network host to your docker run command. This will give your container access to all interfaces on the host.

From docker docs: Note: --network="host" gives the container full access to local system services such as D-bus and is therefore considered insecure.

| improve this answer | |
  • 1
    It's a bit of a hack. I want docker to work as it's supposed to. In this scenario, to get an individual ipv6 address, it would need to be configured inside the container. – user37914 Jul 10 '18 at 18:31

Change the /64 to an /80.


    "ipv6": true,
    "fixed-cidr-v6": "2001:xxxx:5000:20::/80",

You may need to switch on

sysctl -w net.ipv6.conf.all.proxy_ndp=1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.