I follow these steps to create a cluster of Docker clusters.
create cunsol
$ docker-machine create -d virtualbox mh-keystore
$ eval "$ (docker machine env mh-keystore)"
$ docker run -d \
-p "8500: 8500" \
-h "consul" \
progrium / consul -server -bootstrap
create a swarm manager
$ docker-machine create -d virtualbox node1
$ docker run -d -p 4000: 4000 swarm manage -H: 4000 --replication - advertisement $ (ip dock machine node1): 4000 consul: // $ (ip dock machine mh-keystore): 8500
create swarm node
$ docker-machine create -d virtualbox node2
$ docker run -d swarm join --advertise = $ (docker-machine ip node2): 2375 consul: // $ (docker-machine ip mh-keystore): 8500
login node1
$ docker-machine ssh node1
$ docker -H: 4000 info
But this command output
(unknown): 192.168.99.106:2375(node2 ip)
β ID:
β Status: Pending
β Containers: 0 β Reserved processors: 0/0
β Reserved memory: 0 B / 0 B
β Shortcuts:
β Error: Unable to connect to the Docker daemon. Is the docker daemon on this host? ...
How can i fix this? I already checked node2 and it works well.
[Update] I follow this page and it works well. But I still donβt know how to set up a swarm cluster without a docker machine.
[Refresh] Another approach does not work either.
docker-machine create -d virtualbox \ --swarm \ --swarm-discovery="consul://$(docker-machine ip mh-keystore):8500" \ --engine-opt="cluster-store=consul://$(docker-machine ip mh-keystore):8500" \ --engine-opt="cluster-advertise=eth1:2376" \ mhs-demo1
Node1 docker information is displayed by mhs-demo1 ip, but the information is still unknown.
[Update]
when I type eval $ (docker machine env -swarm node1) It shows
TLS connection validation error: "node1" is not a master swarm. --swarm flag is for use with swarm masters. Does this cause an error? Why using the swarm control command to configure is not a swarm master?
This is so strange. How to get the same result as
docker-machine create \ -d virtualbox \ --swarm --swarm-master \ --swarm-discovery="consul://$(docker-machine ip mh-keystore):8500" \ --engine-opt="cluster-store=consul://$(docker-machine ip mh-keystore):8500" \ --engine-opt="cluster-advertise=eth1:2376" \ mhs-demo0
using the swarm command?
I want to use the swarm command because I do not want to declare a swarm master when I create it.
source share