docker swarm join --token <worker_token> <manager_ip>:2377
docker swarm join --manager --token <manager_token> --listen-addr <master2>:2377 <master1>:2377
REQUEST always goes to primary manager always, if the request goes to secondary manager then it is proxied to the primary one.
Primary manager will deligate the request to the different workers
- Manager are need to be odd in number, so that you can solve the split brain problem of the network
- All masters configured using Raft Consensus Group
- All workers communicates through the Gossip Network
docker service create --replicas 3 --name job jboss/wildfly
if the service goes down or container goes off, this this replicas check failes the
**desired(3 replicas) !== actual(one failed and 2 runningg) **
Then docker reconciles the replicas to 3.
Same as the the node failure to fire up the new container
docker service scale web=6
- One instance of service running at each node(docker swarm machine) of the cluster with the mode as global.
docker service create --mode=global --replicas 3 --name job jboss/wildfly
- when weexecute this command it fires up the command on each node of the cluster, downloads the image and creates the service at each node of the cluster
- Define and run multi container applications
- Configuration defined in one or more files
FILE NAME
docker-compose.yml # default file name
RUN
docker-compose up -d
FILE NAME
docker-compose-test.yml
RUN
docker-compose -f docker-compose-test.yml up -d
To run multiple compose files
docker-compose -f file1.yml -f file2.yml up -d