Creating a swarm cluster with Docker for Mac
NickName:justinhj Ask DateTime:2016-07-23T11:15:17

Creating a swarm cluster with Docker for Mac

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/

Copyright Notice:Content Author:「justinhj」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/38537782/creating-a-swarm-cluster-with-docker-for-mac

Answers
Ohmen 2016-07-29T14:58:08

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.\n\nBTW as long as you are on the same docker version, using Docker for Mac and docker-machine together should not cause problems. ",


VonC 2016-07-25T06:12:14

\n But this guide uses docker-machine.\n\n\nThat should not be an issue: each time you see in the tutorial\n\n\n Point your environment to the Swarm master.\n\n\n$ eval $(docker-machine env --swarm mhs-demo0)\n\n\nIt simply means you are supposed to execute the next docker command on the swarm master (one of your mac)\n\n\n Switch to each Swarm agent in turn and list the networks.\n\n\n$ eval $(docker-machine env mhs-demo0)\n\n\nSimilarly, you switch to your other mac to execute other docker commands.",


More about “Creating a swarm cluster with Docker for Mac” related questions

Creating a swarm cluster with Docker for Mac

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 ru...

Show Detail

Creating a docker swarm cluster in Vagrant

I'm trying to create a swarm cluster of diffferent ubuntu VMs running in Vagrant. These have docker enabled via the vagrant file that boots them. Of the three VM's I started the swarm cluster on one

Show Detail

Docker Swarm creating real cluster: Registered and Removed

I was recently playing with Docker and just discovered Swarm. In my scenario I've two hosts (irons) with Ubuntu where docker is installed and a laptop (osx) host1 docker-node (212.x.x.1) host2 doc...

Show Detail

Docker Swarm on Mac

Is Docker Swarm supported on Docker for Mac? When I try to use Docker Swarm I get an error: $ docker swarm init docker swarm init is only supported on a Docker cli with swarm features enabled I ...

Show Detail

Docker Swarm vs. Docker Cluster

I created a swarm cluster via docker-machine -d azure --swarm --swarm-master --swarm-discovery token://SWARM_CLUSTER_TOKEN my-swarm-master and docker-machine -d azure--swarm --swarm-discovery...

Show Detail

Prefect in a Docker Swarm cluster

We actually use Docker Swarm to manage our cluster. Some services are scheduled with swarm-cronjob and run at fixed time, but we want more flexibility. So we decided to give Prefect a chance and it...

Show Detail

How to deploy a KinD cluster in a docker swarm

I have deployed a docker swarm to Azure following the instructions in the quickstart guide. I also set up an ssh tunnel using the command from the quickstart: ssh -L 2375:swarm-master-0:2375 -N use...

Show Detail

Docker, Is it possible to form a cluster (swarm mode) with linux and mac?

Per-container IP addressing is not possible The docker (Linux) bridge network is not reachable from the macOS host https://docs.docker.com/docker-for-mac/networking/ What does the above line me...

Show Detail

Docker Swarm: difference between --swarm-discovery and cluster-store

When creating a new swarm node we have something like the following code for the swarm master: docker-machine create \ -d digitalocean \ --swarm \ --swarm-master \ --swarm-discovery="

Show Detail

Add Docker Machine to Swarm cluster after creation

A Docker Swarm cluster can be created as: docker-machine create \ -d virtualbox --virtualbox-disk-size "5000" \ --swarm --swarm-master \ --swarm-discov...

Show Detail