Java Magazine, Jan/Feb 2016
ORACLE COM JAVAMAGAZINE JANUARY FEBRUARY 2016 76 containers docker machine create d virtualbox consul machine Then connect to this machine eval docker machine env consul machine Run the Consul service using the following Compose file myconsul image progrium consul restart always hostname consul ports 8500 8500 command server bootstrap Start this service using docker compose up d You can verify the started container using the docker ps command described in the first part of this article Create the Docker Swarm Cluster Docker Swarm is fully integrated with Docker Machine and so it is the easiest way to get started Create a swarm master and point to the Consul discovery service docker machine create d virtualbox virtualbox disk size 5000 swarm swarm master swarm discovery consul docker machine ip consul machine 8500 engine opt cluster store consul docker machine ip consul machine 8500 engine opt cluster advertise eth1 2376 swarm master The following are the meanings of these switches swarm configures the machine with Docker Swarm swarm master configures the created machine to be the swarm master swarm discovery defines the address of the discovery service cluster advertise advertises the machine on the network cluster store designates a distributed key value storage back end for the cluster virtualbox disk size sets the disk size for the created machine to 5 GB This is required so that the WildFly and Couchbase images can be downloaded onto any of the nodes You can get more information about this machine by running the inspect command If you run it youll see that the disk size is indeed 5 GB Now create a new machine to join this cluster docker machine create d virtualbox virtualbox disk size 5000 swarm swarm discovery consul docker machine ip consul machine 8500 engine opt cluster store consul docker machine ip consul machine 8500 engine opt cluster advertise eth1 2376 swarm node 01 Notice that no swarm master option is specified in this command which ensures that the created machine is a worker node If you list all the created machines you will see the contents of Table 2 The machines that are a part of the cluster have the clusters name in the SWARM column otherwise that column is blank for machines that are not part of the cluster For example consul machine is a standalone machine whereas all the other machines are part of the swarm master cluster The swarm master is also identified by master in the SWARM column Connect to the swarm cluster and find some information about it
You must have JavaScript enabled to view digital editions.