Java Magazine, Jan/Feb 2016
NAME ACTIVE DRIVER STATE URL SWARM consul machine virtualbox Running tcp 19216899100 2376 swarm master virtualbox Running tcp 19216899101 2376 swarm master master swarm node 01 virtualbox Running tcp 19216899102 2376 swarm master Table 2 The contents of the sample Docker Swarm ORACLE COM JAVAMAGAZINE JANUARY FEBRUARY 2016 77 containers eval docker machine env swarm swarm master docker info Note that swarm is specified to connect to the swarm cluster Otherwise the command will connect to the swarm master machine only The docker info command provides detailed output about the diferent nodes and the number of containers running on each node The first part of the output provides a summary and is shown below docker info Containers 3 Images 2 Role primary Strategy spread Filters health port dependency affinity constraint There are two nodes one swarm master and one swarm worker node There are three containers running in this cluster one swarm agent on the master and each node and there is an additional swarm agent master running on the master Start the Application Environment The cluster is now ready and our application can be deployed to it This Java EE application deployed on WildFly will provide a CRUD REST interface to the data in Couchbase I will use the Compose file shown earlier to start the application environment But before I start lets look at the current state of the network in the cluster By default Docker creates three networks for each host as shown in Table 3 Docker allows you to create bridge and overlay networks Bridge networks span a single host and overlay networks span multiple hosts The Docker Compose application can be started with the x networking switch In this case a bridge network is created for a single host and an overlay network is created for a swarm cluster Make sure you are connected to the cluster by running the following command eval docker machine env swarm swarm master I will use the Compose file shown earlier to start WildFly and Couchbase In the WildFly service the COUCHBASE_ URI environment variable is set to db And this is the name of the Couchbase container Start the application with NETWORK NAME PURPOSE bridge DEFAULT NETWORK THAT CONTAINERS CONNECT TO none CONTAINER SPECIFIC NETWORKING STACK host ADDS THE CONTAINER ON THE HOSTS NETWORKING STACK Table 3 Three networks created by Docker
You must have JavaScript enabled to view digital editions.