Docker Community Forums

Share and learn in the Docker community.

Get Started part 4 connection refused from node on virtual machine


(Alexchris) #1

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?


(Mwharrisjr) #2

I am having the same issue with connecting, a solution would be very much appreciated.


(Dkolson) #3

same issue here even tried redoing part 4 with no luck


(Labrook) #4

Same here. Stuck on part 4, and got “port 80: connection refused” error. How come the example in the official tutorial not work?


(Nnvishnya) #5

Have the same issue!


(Ievgenii) #6

Same here. Was something changed in the documentation recently?


(Qkrcldn123) #7

If you using VirtualBox for nodes.

You have to do configure the port forwarding.

VBoxManage modifyvm "myvm1" --natpf1 allow_web,tcp,,4000,,80
VBoxManage modifyvm "myvm2" --natpf1 allow_web,tcp,,4000,,80

See this. It will be solve your problem :


(Elavaud) #8

Yep. Same for me.
I do not think the issue is coming from virtualbox as I am able to deploy my solution using:

docker-machine ssh myvm1 "docker run -d -p '4000:80' rayeshuang/friendlyhello"

And can then access the app through my browser using myvm1 IP and port 4000.


(Jsim0net) #9

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.


(Elavaud) #10

The issue is well documented here

I downgraded to the boot2docker.iso 18.06.1-CE that you can download here

Destroy your VMs, then create them again specifying the path to your downloaded boot2docker iso with " --virtualbox-boot2docker-url".

For example:

docker-machine create --driver virtualbox --virtualbox-boot2docker-url ~/.docker/machine/cache/boot2dockerv18061CE.iso myvm1

Then start again part 4…


(Jsim0net) #11

Can confirm that @elavaud solution works.

Cheers for the help. /J


(Andreasnilsen) #12

The equivalent workaround for Hyper-V VM’s is:

docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" --hyperv-boot2docker-url "https://github.com/boot2docker/boot2docker/releases/download/v18.06.1-ce/boot2docker.iso" myvm1

Docker tutorial issues
(Ocarlsen) #13

Confirmed, thank you @elavaud. If using VirtualBox, one can also set this environment variable first, then destroy your VMs and re-create them:

VIRTUALBOX_BOOT2DOCKER_URL=https://github.com/boot2docker/boot2docker/releases/download/v18.06.1-ce/boot2docker.iso

PS. If your docker-compose.yml file is set up like this (in Part 3)

ports:
  - "4000:80"

Then the URLs to hit in Part 4 will also need to specify port 4000.


(Alexchris) #14

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.


#15

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)