Docker Community Forums

Share and learn in the Docker community.

How to create an IPv6-only bridge network

docker

(Vladimir Varankin) #1

Is it possible to create a custom bridge network that only has IPv6 address?

The docs claims that bridge can have a single subnet only, but if one does:

$ docker network create --driver bridge --ipv6 --subnet 2a02:6b8:b010:9020:1::/80 mybridge_nw1

one gets

$ docker network inspect mybridge_nw1

[
  {
    "Name": "mybridge_nw1",
    "Driver": "bridge",
    "EnableIPv6": true,
    "IPAM": {
        "Driver": "default",
        "Options": {},
        "Config": [
            {
                "Subnet": "172.20.0.0/16",
                "Gateway": "172.20.0.1/16"
            },
            {
                "Subnet": "2a02:6b8:b010:9020:1::/80"
            }
        ]
    },
    ···

Containers attached to this network have both IPv4 and IPv6 address:

docker run --rm -ti --net mybridge_nw1 debian ip a s eth0

57: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether 02:42:ac:14:00:02 brd ff:ff:ff:ff:ff:ff
    inet 172.20.0.2/16 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2a02:6b8:b010:9020:1::2/80 scope global nodad
       valid_lft forever preferred_lft forever
    inet6 fe80::42:acff:fe14:2/64 scope link
       valid_lft forever preferred_lft forever

Our whole infrastructure is IPv6-only and as I’ve been told that there’re solutions like old Node.js of Java which might work unexpectedly in case when the environment they are running at (e.g. container) said that there is an IPv4 network while host system doesn’t.

We use linux machines that run in our corporate cloud and docker-engine 1.11, if that matter.