I have a problem with deploying local virtualbox based swarm - I have followed the instructions in the official docker documentation regarding setting up master/worker nodes using the docker-machine tool. I have created the token on dockerhub and used --swarm (and --swarm-master) with --swarm-discovery token://XXXX ... so far so good, two machines running, seemingly registered as the Swarm master and worker:
spaceback@brutus:~$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
swarm-master * (swarm) virtualbox Running tcp://192.168.99.100:2376 swarm-master (master) v1.12.0
swarm-node1 - virtualbox Running tcp://192.168.99.101:2376 swarm-master v1.12.0
spaceback@brutus:~$ docker run --rm swarm list token://[....]
192.168.99.101:2376
192.168.99.100:2376
and after setting the correct environment values using the "eval $(docker-machine env --swarm swarm-master)" I can get status using the "docker info" stating that I have two nodes running...
but any attempt to run any other docker swarm commands (docker node..., docker service...) I get "Error response from daemon: 404 page not found".
What am I doing wrong?
It appears you're attempting to use the new swarm mode features against the older docker swarm.
The following script creates a HA Swarm cluster with 3 managers and 2 workers (using Docker 1.12.0):
#=========================
# Creating cluster members
#=========================
docker-machine create --driver virtualbox node1
docker-machine create --driver virtualbox node2
docker-machine create --driver virtualbox node3
docker-machine create --driver virtualbox node4
docker-machine create --driver virtualbox node5
#===============
# Starting swarm
#===============
MANAGER_IP=$(docker-machine ip node1)
docker-machine ssh node1 docker swarm init --advertise-addr $MANAGER_IP
#===============
# Adding members
#===============
MANAGER_TOKEN=$(docker-machine ssh node1 docker swarm join-token --quiet manager)
WORKER_TOKEN=$(docker-machine ssh node1 docker swarm join-token --quiet worker)
docker-machine ssh node2 docker swarm join --token $MANAGER_TOKEN $MANAGER_IP:2377
docker-machine ssh node3 docker swarm join --token $MANAGER_TOKEN $MANAGER_IP:2377
docker-machine ssh node4 docker swarm join --token $WORKER_TOKEN $MANAGER_IP:2377
docker-machine ssh node5 docker swarm join --token $WORKER_TOKEN $MANAGER_IP:2377
List the swarm members
$ docker-machine ssh node1 docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
4s0mrh2u4sa2p260ung8ipb0m * node1 Ready Active Leader
5ra7b8cwarpcpa47p2gq2ecxs node2 Ready Active Reachable
66t3pq66ynlvyl3do6lpn9kzb node3 Ready Active
7k5n1id2q6yncqjbv7l8ec0r5 node5 Ready Active
833e4ya58hq62epplreyvwtnm node4 Ready Active
Creating a service
$ docker-machine ssh node1 docker service create --name web --replicas=10 -p 30000:80 nginx
$ docker-machine ssh node1 docker service ps web
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR
2fxy4n57p8ot3mn0kws96pnuk web.1 nginx node1 Running Running 30 seconds ago
cmm1s3h8ds7tmppf7pwvl5zxw web.2 nginx node5 Running Running 6 seconds ago
7ixgtqlz049ggi90363js088b web.3 nginx node1 Running Running 30 seconds ago
4o1e2wkh0x4rp8h9o73as8drf web.4 nginx node3 Running Running 22 seconds ago
6lufnzzddljlw0lnu0qyftzh6 web.5 nginx node3 Running Running 22 seconds ago
49g43g23t4r9lpmitfs4uu1j6 web.6 nginx node2 Running Running 3 seconds ago
43dopngi08licw4xttipnfdb6 web.7 nginx node2 Running Running 3 seconds ago
8d47dvmokf65xb271fyk3jlbu web.8 nginx node4 Running Running 7 seconds ago
2t56edm3k4x98yjkvgamyq6v4 web.9 nginx node5 Running Running 6 seconds ago
byij5j5pom1t3elu2ydteasg7 web.10 nginx node4 Running Running 7 seconds ago