I following the getting started tutorial, but I get stuck at this point. When I try to type on my browser both the IP of the manager and the worker http://192.168.99.100 I get the message 192.168.99.100 or 192.168.99.101 refused to connect.
Both machines are running ok, I deployed the application using the same .yml file as in this part of the tutorial, as instructed. I initialised the swarm on port 2377, as advised, and when I run docker node lsI get the following message:
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
tzyc2gdlt4k4lsvz01d980324 * myvm1 Ready Active Leader 18.09.0
g6pekmpole72tai65josbnew6 myvm2 Ready Active 18.09.0
Which makes me believe everything is running fine.
Also, when I dpeloy the yml file on the manager and then run docker stack ps getstartedlab
I get:
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
qejmyl4tcx8z getstartedlab_web.1 alexchris/get-started:part2 myvm1 Running Running 35 minutes ago
cyuvbf8ko1ae getstartedlab_web.2 alexchris/get-started:part2 myvm2 Running Running 35 minutes ago
on74aelrfygm getstartedlab_web.3 alexchris/get-started:part2 myvm1 Running Running 35 minutes ago
yod8gys4i298 getstartedlab_web.4 alexchris/get-started:part2 myvm2 Running Running 35 minutes ago
sc77zg8pcs9v getstartedlab_web.5 alexchris/get-started:part2 myvm2 Running Running 35 minutes ago
Which again should be a signal that everything is going fine, but still I can’t connect to the virtual machines.
I tried to run the curl command and this is the output:
curl http://192.168.99.100
curl: (7) Failed to connect to 192.168.99.100 port 80: Connection refused
I tried to tear down the swarm removed the stack, restarted the docker daemon and repeated the process but I had no luck. I am on xubuntu 18.04 bionic and using docker version 18.09.0.
Could anyone help to understand why I cannot reach service?
Having the same issue as @elavaud with part 4 and the virtualbox vm. When using docker run f it works with the ip (myvm1), but when using the stack with the mesh networking things stop working. Although doing netstat tulp on myvm1/2 shows that the port is open and that the dockerd is the one listening (as opposed to docker-proxy when doing run).
Manually attaching to a container and issuing a curl returns a response. But nothing is returned when doing curl on the vm itself or from the outside (connection refused).
The two VM’s can connect to each other fine, as they are able to connect to each other when using netcat/nc. And the required ports appear open between the VM’s. Although the issue should not be here as a single node does not work either.
One thing that works is using the (on mac) local docker instance and using it as a single node swarm, with stack deploy + mesh networking.
The solution of @elavaud worked for me, thanks. Maybe a short reference in th troubleshooting section of the guide would be useful until the compatibility issue on docker-machine is solved.
Thanks a lot!! Hard to believe I burnt about 3 hours around this issue for nothing.
After re-creating the VMs, I had to docker-machine regenerate-certs in order to fix the env error
Get Started part 4 does not mention using port 4000 in the url (even though docker-compose.yml uses it). So the browser or curl should be able to connect at port 80. Connecting at port 4000 was possible even without the version 18.06.1 - by using boot2docker version 18.09.0 . So the question is how to connect to the VM’s at port 80, as shown in the guide, when the docker-compose.yml specifies the port mapping as ‘4000:80’ ?
You have to change the mapping in docker-compose.yml. It is not mentioned in the part-4 doctmentation but if you see the screen cast at the end of page it is showing mapping as - “80:80”.
Now I could get the response but I see the loadbalancing is not working as described in the document. The request is always served by only one container even if I hit any of the 2 available ip addresses of the VMs.