Docker Community Forums

Share and learn in the Docker community.

Can't get IPv6 to work with Docker on Amazon EC2

Hi,

I want to run multiple containers that should have egress access to IPv6 websites. Docker requires specifying an IPv6 subnet of /64 size in order to use IPv6. However, Amazon doesn’t allow you to assign an entire subnet to an instance. At most, you can assign only a few IPs to an instance, the limit varies based on the instance type.

Using the host network let’s me use ping6 and curl -6 from within the container, but the subsequent containers beyond the first one fail to start due to some error with xvfb. (I’m using a docker image based on docker-selenium

What is the best way to use IPv6 with docker in production, when you have limited IPs (say 2). I tried docker-ipv6nat, but I’m not able to get it to work either.

I have also created an issue on the moby GitHub repo, with more details in case you need to refer.

Any help would be appreciated.

Bump. Can use some help here.

I didn’t need to assign a AWS subnet to docker, but in my case a dependency in one of my containers required IPv6.

In essence, I have a CodeBuild (standard 2.0:docker) instance where I’m building and testing a web application that user chromium and cromedriver. Chromium needed to bind to an IPv6 address.

In order for a docker container to be assigned an IPv6 address I needed to create the daemon.json configuration and set ipv6 to true and assign a subnet.

The command portion in the install phase on my buildspec file looks like:

The commented out portion does the same but rather sets the arguments on the actual run command.

install:
    commands: |
     mkdir -p /etc/docker && echo '{"ipv6": true,"fixed-cidr-v6": "2001:db8:1::/64"}' > /etc/docker/daemon.json;
     # nohup  /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://0.0.0.0:2375 --ipv6 --fixed-cidr-v6=2001:db8:1::/64 --storage-driver=overlay&
     # timeout -t 15 sh -c "until docker info; do echo .; sleep 1; done"