0

Unfortunately I am not able to dump configs in here so I will attempt to describe.

I have a docker compose file, when I do a docker up on it things work fine.

However, when I start it with docker stack deploy --compose-file {the file that worked} I am not able to access the service via "localhost" in Chrome. I can however with Firefox. I noticed that in Chrome I was able to access it with "127.0.0.1". I tried disabling ipv6 on my host machine, and that allowed me to use "localhost" in Chrome. I later did more testing with curl forcing ipv4 and ipv6.

It looks like Chrome is using my ipv6 local address when resolving "localhost" if ipv6 is enabled, and this seems to cause issues when using docker swarm in particular.

Any thoughts on getting docker swarm to work with ipv6? Thank you!

Edit: The stack works on OSX and I can use curl -6 localhost:port successfully unlike on linux.

Edit2: docker swarm ipv6 just seems broken https://github.com/moby/moby/issues/24379

  • What's in your `/etc/hosts` file? What's the output of `ss -tnlp` while the problem is occurring? – Michael Hampton Dec 02 '18 at 02:06
  • pasting in here is not great, but, /etc/hosts has both `::1 ip6-localhost ip6-loopback` and `127.0.0.1 localhost` in it, and `ss -tnlp | grep 5000` results in `LISTEN 8 128 *:5000 *:*` (I'm hitting port 5000 from the browser) – ipv6dockerswarm Dec 02 '18 at 02:54

2 Answers2

0

Are you sure you want to use ip6? Because another solution could be modifying etc/hosts so that localhost directs to 127.0.0.1.

Yamuk
  • 121
  • 1
  • 3
  • The only reason ipv6 is being used is because Chrome is doing it. I do indeed hack a hack around to use 127.0.0.1 instead of localhost. – ipv6dockerswarm Dec 02 '18 at 02:51
0

Correct, swarm overlay networks don’t support ipv6

Bret Fisher
  • 3,963
  • 2
  • 20
  • 25
  • I really appreciate this confirmation. I have a workaround, but it felt dirty, I'll save my Sunday and stop investing time in trying to figure out how to avoid the workaround. Thank you. – ipv6dockerswarm Dec 02 '18 at 16:50
  • @ipv6dockerswarm could you share the workaround? I've tearing my hair out for this problem for hours now... thanks! – jet Apr 02 '19 at 01:44