9

A docker container of mine exposes a HTTP interface on port 8500, which is mapped to host port 8500. It is not IPv6 enabled. This still means, I should be able to access it at localhost:8500. IPv6 is preferred, so I end up with a request to [::1]:8500. This one gets stuck, it never returns.

Reproducing this with curl, this command gets stuck:

curl -g -6 "http://[::1]:8500"

curl's --verbose option reveals nothing, neither does --ascii-trace. At the same time, a request to IPv4's localhost succeeds:

curl http://127.0.0.1:8500

giving me the expected HTML. If I run an IPv4 HTTP server on loopback, using

python -m SimpleHTTPServer 4001

then I get lots of HTML for IPv4's localhost

curl http://127.1:4001

and a proper connection failure for IPv6:

curl -g -6 "http://[::1]:4001"
curl: (7) Failed to connect to ::1 port 4001: Connection refused

Things to note: Docker 1.7.1. IPv6 is not enabled for the container, hence there are no IPv6 iptable rules. (ip6tables -v -L gives nothing)

My question is: Why does the request get stuck, and doing what?

  • 1
    Would you show us the output of "netstat -6 -an"? – Rui F Ribeiro Dec 1 '15 at 11:20
  • Yep, docker is listening on that port: tcp6 0 0 :::8500 :::* LISTEN 1648/docker Fascinating. Why? And why is it blocking? – mknecht Dec 1 '15 at 11:55
  • Listening and not configured, or IPv6 disabled in sysctl, I guess. nginx, apache, lighthttp, would you append the web server in question to the post, please? – Rui F Ribeiro Dec 1 '15 at 13:18
  • Inside the container, Consul, a key-value store for configuration, is listening. But I don't think it's relevant: the container has not been IPv6-enabled. That request should never reach Consul. I don't get on which layer it gets stuck, though. On the host, /proc/sys/net/ipv6/conf/all/disable_ipv6 yields 0, so IPv6 should be enabled. – mknecht Dec 1 '15 at 13:39
  • 2
    That does not mean much. You can have IPv6 disabled even in sysctl, and in newer kernels, as long as the program binds to an IPv6 socket, the request is honoured. A pain in the ass, as you must go through each daemon that supports IPv6 and disable the IPv6 configuration. – Rui F Ribeiro Dec 1 '15 at 14:09

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.