I have an Ubuntu server 16.04 LTS running both IPv4 and IPv6 (dual-stack). This server is also running Docker. However, I have problems whenever I try to access the containers in the swarm, but only over IPv6. Here is my steps:

I have created an simple app running a gnuicron webserver:

def app(environ, start_response):
    """Simplest possible application object"""
    data = b'Hello, World!\n'
    status = '200 OK'
    response_headers = [
        ('Content-type', 'text/plain'),
        ('Content-Length', str(len(data)))
    start_response(status, response_headers)
return iter([data])

I run this with gunicorn -w 4 -b [::]:5678 myapp:app on my server, and verify it works by running this on a dual-stack client in my network:

$ curl --connect-timeout 15 http://[2001:db8:db0::5]:5678
Hello, World!
$ curl --connect-timeout 15
Hello, World!

I write a Dockerfile and run it:

docker build -t docker_ipv6_test .
docker run --rm --init -p 5678:5678 docker_ipv6_test

I run the same verification as about, and it works as expected. Then I write a docker-compose.yml:

version: '3'
    image: docker_ipv6_test:latest
      replicas: 1
        condition: on-failure
        - '5678:5678/tcp'

and run it:

docker stack deploy -c docker-compose.yml ipv6_test

Then this happens:

$ curl --connect-timeout 15 http://[2001:db8:db0::5]:5678
curl: (28) Operation timed out after 0 milliseconds with 0 out of 0 bytes received
$ curl --connect-timeout 15
Hello, World!

But I was wondering if I am doing something wrong, or I have hit a bug?

All of my code and files are available here: https://github.com/SitronNO/docker_ipv6_test

Your Answer

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

Browse other questions tagged or ask your own question.