I have the following tiny issue : google chrome (chromium actually) can’t connect to the http services in my containers in my local swarm using “localhost” domain.
It’s really specific : only with localhost (other domain aliases or 127.0.0.1 work), only with chrome (firefox and wget are ok) and only from containers in a service stack (it works when i run a container directly).
It’s really not critical but i’d like to understand, and networking is not what i know most.
The stack has nothing special : there are 3 different services linked together by the implicit automatic network. It’s merely what we can see in the getting started guides, except i used “mode: global” for the “deploy” parameters.
Everything run on the same computer, on Ubuntu 16
Docker Server Version: 17.03.1-ce
$ docker network ls
NETWORK ID NAME DRIVER SCOPE
32562cc1e37a bridge bridge local
63057fc50251 docker_gwbridge bridge local
a3fcb51d7269 host host local
ha4btuki0jtc ingress overlay swarm
r9ho0gy0v6ub my-local-stack_default overlay swarm
673761bc23d3 none null local
$ netstat -n
Table de routage IP du noyau
Destination Passerelle Genmask Indic MSS Fenêtre irtt Iface
default 192.168.0.254 0.0.0.0 UG 0 0 0 wlp3s0
link-local * 255.255.0.0 U 0 0 0 docker_gwbridge
172.17.0.0 * 255.255.0.0 U 0 0 0 docker0
172.18.0.0 * 255.255.0.0 U 0 0 0 docker_gwbridge
192.168.0.0 * 255.255.255.0 U 0 0 0 wlp3s0
The problem that you can’t connect to the http services in my containers in my local swarm using “localhost” domain seems pretty hard to solve. You should check out this website Chrome ERR_CONNECTION_RESET Error for solution to your problem. Hope this helps.
Having the same issue also. I can connect using 127.0.0.1 from Chrome but not using localhost. There are no issues using localhost with curl and Firefox.
Same issue here. This is very inconvenient as my other components send responses with ACCESS-CONTROL-ALLOW-ORIGIN tailored to xx.localhost, not to an ip address.
I’m having the exact same issue, apparently chrome is using the ipv6 localhost.
To reproduce in curl try curl -v ip6-localhost:$SERVICE_PORT
or if ip6-localhost is not set in your hosts file curl -v ::1:$SERVICE_PORT
If anyone knows how to get chrome to not bypass the hosts file please let me know. For now the workaround has to be use 127.0.0.1 which is very annoying.