mrgleam

Santi Lertsumran

Engineer | Gopher | Duck | Love My Cats

Github:Mrgleam

What is Swarm?

Refer : http://www.slideshare.net/linux.rafa/docker-112-swarm-mode
Refer : https://www.infoq.com/news/2016/06/dockercon-docker-swarm
## Swarm Mode is optional
## Open ports between the hosts - TCP port 2377 for cluster management communications - TCP and UDP port 7946 for communication among nodes - TCP and UDP port 4789 for overlay network traffic
#### Environment Setup ``` $ docker-machine create -d virtualbox --virtualbox-memory 512 swarm01 $ docker-machine create -d virtualbox --virtualbox-memory 512 swarm02 $ docker-machine create -d virtualbox --virtualbox-memory 512 swarm03 $ docker-machine create -d virtualbox --virtualbox-memory 512 \ --engine-label com.example.storage="ssd" swarm04 ``` #### Change to docker environment terminal (OS X, Linux) ``` $ eval $(docker-machine env swarm01) ``` #### Example docker image ``` $ docker pull francois/apache-hostname ```
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
#### Try to drain 1 node ``` $ docker node update --availability drain swarm03 ```
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
#### Create service with engine labels ``` $ docker service create --replicas 3 --name redis \ --constraint 'engine.labels.com.example.storage == ssd' redis $ docker service scale redis=10 ```
# Rolling update
``` $ docker service create --replicas 3 --name redis --update-delay 10s redis:3.0.6 ``` By default the scheduler updates 1 task at a time. You can pass the ```--update-parallelism``` flag to configure the maximum number of service tasks that the scheduler updates simultaneously.
By default, when an update to an individual task returns a state of RUNNING, the scheduler schedules another task to update until all tasks are updated. If, at any time during an update a task returns FAILED, the scheduler pauses the update. You can control the behavior using the `--update-failure-action` flag for `docker service create` or `docker service update`.
``` $ docker service inspect --pretty redis ID: 0u6a4s31ybk7yw2wyvtikmu50 Name: redis Mode: Replicated Replicas: 3 Placement: Strategy: Spread UpdateConfig: Parallelism: 1 Delay: 10s ContainerSpec: Image: redis:3.0.6 Resources: ```
``` $ docker service update --image redis:3.0.7 redis redis ``` ``` $ docker service inspect --pretty redis ID: 0u6a4s31ybk7yw2wyvtikmu50 Name: redis Mode: Replicated Replicas: 3 Placement: Strategy: Spread UpdateConfig: Parallelism: 1 Delay: 10s ContainerSpec: Image: redis:3.0.7 Resources: ```
``` $ docker service inspect --pretty redis ID: 0u6a4s31ybk7yw2wyvtikmu50 Name: redis ...snip... Update status: State: paused Started: 11 seconds ago Message: update paused due to failure or early termination of task 9p7ith557h8ndf0ui9s0q951b ...snip... ``` To restart a paused update run docker service update . For example: ``` docker service update redis ```
# Orchestration Deep Dive
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi
Refer : http://www.slideshare.net/Docker/whats-new-in-docker-112-by-mike-goelzer-and-andrea-luzzardi

Q&A

THE END

Thank you very much