I've been trying to follow this tutorial: https://docs.docker.com/engine/swarm/swarm-tutorial/
Instead of running it on some real linux hosts or local VMs I want to network a couple of MacBooks running Docker desktop for Mac.
Following the tutorial I've installed Docker desktop for Mac on two machines. In a terminal on the first machine docker swarm create
works and creates a ca hash and id.
Carrying on to the second machine I execute the join command by pasting it from one to the other.
The second machine cannot connect. This is expected since the IP address show in the output is clearly the IP address inside the virtual machine and not an address on my machine. I tried diverting from the tutorial by specifying the address of the local network adaptor but it says it cannot bind to that address. I know all the ports are open and the machine can connect to each other.
So it seems to me I'm fundamentally misunderstanding the aim of the tutorial or how to setup the two Macs so they can communicate. By googling for solutions it seems there are several possibilities for what I need to do:
Run a distributed kv store to help the swarm network coordinate (but isn't this the point of the new orchestration?) Set up a port tunnel on each machine from the network adaptor to the alpine linux docker daemon Give up and just test my cluster locally
Update: after some more research it seems I should create an overlay network using this guide. But this guide uses docker-machine. As far as I understand I should/can not use docker-machine along with Docker desktop for Mac, or is that incorrect?
https://docs.docker.com/engine/userguide/networking/get-started-overlay/
You have to set up a port tunnel to promote the docker daemon port inside the VM to the hosts network interface. To check if you can reach the daemon of another machine use https://otherMachineIp:DaemonPort/v1/_ping. If this succedes you can reach the other daemon to set up a swarm.
BTW as long as you are on the same docker version, using Docker for Mac and docker-machine together should not cause problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With