It is the screen snapshot from my laptop , so easy with dockermachine
docker@docker01:~$ docker run swarm create
Unable to find image 'swarm:latest' locally
latest: Pulling from library/swarm
2bc79aec8ea0: Pull complete
dc2fb86a875a: Pull complete
435e648d0f23: Pull complete
e16042a92d05: Pull complete
045bd7b00b5b: Pull complete
3caea1253d76: Pull complete
2b4c55187a27: Pull complete
6b40fe7724bd: Pull complete
Digest: sha256:51a30269d3f3aaa04f744280e3c118aea032f6df85b49819aee29d379ac313b5
Status: Downloaded newer image for swarm:latest
85558240c5f00e704d04ba34da1bb26d
docker@docker01:~$ exit[root@oc3053148748 ~]# dockermachine create \
d virtualbox \
swarm \
swarmmaster \
swarmdiscovery token://<TOKENFROMABOVE \
[root@oc3053148748 ~]# dockermachine create \
d virtualbox \
swarm \
swarmmaster \
swarmdiscovery token://85558240c5f00e704d04ba34da1bb26d \
swarmmaster
Running precreate checks...
Creating machine...
(swarmmaster) OUT | Creating VirtualBox VM...
(swarmmaster) OUT | Creating SSH key...
(swarmmaster) OUT | Starting VirtualBox VM...
(swarmmaster) OUT | Starting VM...
Waiting for machine to be running, this may take a few minutes...
Machine is running, waiting for SSH to be available...
Detecting operating system of created instance...
Detecting the provisioner...
Provisioning created instance...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Configuring swarm...
To see how to connect Docker to this machine, run: dockermachine env swarmmaster
[root@oc3053148748 ~]# dockermachine create \
d virtualbox \
swarm \
swarmdiscovery token://85558240c5f00e704d04ba34da1bb26d \
swarmagent01
Running precreate checks...
Creating machine...
(swarmagent01) OUT | Creating VirtualBox VM...
(swarmagent01) OUT | Creating SSH key...
(swarmagent01) OUT | Starting VirtualBox VM...
(swarmagent01) OUT | Starting VM...
Waiting for machine to be running, this may take a few minutes...
Machine is running, waiting for SSH to be available...
Detecting operating system of created instance...
Detecting the provisioner...
Provisioning created instance...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Configuring swarm...
To see how to connect Docker to this machine, run: dockermachine env swarmagent01
[root@oc3053148748 ~]# dockermachine create \
d virtualbox \
swarm \
swarmdiscovery token://85558240c5f00e704d04ba34da1bb26d \
swarmagent02
Running precreate checks...
Creating machine...
(swarmagent02) OUT | Creating VirtualBox VM...
(swarmagent02) OUT | Creating SSH key...
(swarmagent02) OUT | Starting VirtualBox VM...
(swarmagent02) OUT | Starting VM...
Waiting for machine to be running, this may take a few minutes...
Machine is running, waiting for SSH to be available...
Detecting operating system of created instance...
Detecting the provisioner...
Provisioning created instance...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Configuring swarm...
To see how to connect Docker to this machine, run: dockermachine env swarmagent02
ot@oc3053148748 ~]# dockermachine ls
NAME ACTIVE DRIVER STATE URL SWARM
docker01 virtualbox Running tcp://192.168.99.100:2376
swarmagent01 virtualbox Running tcp://192.168.99.102:2376 swarmmaster
swarmagent02 virtualbox Running tcp://192.168.99.103:2376 swarmmaster
swarmmaster virtualbox Running tcp://192.168.99.101:2376 swarmmaster (master)
[root@oc3053148748 ~]# dockerlogin swarmmaster
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / === ~~~
\______ o __/
\ \ __/
\____\_______/
_ _ ____ _ _
| |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.9.1, build master : cef800b Fri Nov 20 19:33:59 UTC 2015
Docker version 1.9.1, build a34a1d5
docker@swarmmaster:~$ docker run swarm list token://85558240c5f00e704d04ba34da1bb26d
192.168.99.102:2376
192.168.99.101:2376
192.168.99.103:2376
</code>