Docker Swarm by Victor Vieux

9
Docker Swarm @aluzzardi - @vieux

description

Docker Swarm is native clustering for Dockerized distributed apps. It picks-up where Docker Machines leaves off by optimizing host resource utilization and providing failover services. Specifically, Docker Swarm allows users to create resource pools of hosts running Docker daemons and then schedule Docker containers to run on top, automatically managing workload placement and maintaining cluster state. For input, the default scheduler uses the resource requirements of the Docker container workloads and the resource availabilities of the hosts in the cluster and then uses bin pack to automatically optimize placement of workloads. For example, here is how a user would schedule a redis container requiring 1 gig of memory: % docker run -d -P -m 1g redis To support specific requirements and policy-based scheduling, Docker Swarm provides standard and custom constraints. For example, say that to ensure good I/O performance you want to run your MySQL container on a host with SSD storage. You could express this as a constraint when scheduling the MySQL workload as follows: % docker run -d -P -e constraint:storage=ssd mysql In addition to resource optimization, Docker Swarm provides high-availability and failover. Docker Swarm continuously health-checks the Docker daemon’s hosts and, should one suffer an outage, automatically rebalances by moving and re-starting the Docker containers from the failed host to a new one. One of the unique aspects of Docker Swarm is that it can scale with the lifecycle of the app. This means that the developer can start with a “cluster” consisting of a single host and maintain a consistent interface as the app scales from one host to two, 20, or 200 hosts. Finally, Docker Swarm has a pluggable architecture and ships “batteries included” with a default scheduler. To this end, we’re excited to announce a partnership with Mesosphere to make it a “first class citizen” in Docker Swam for landing Docker container workloads. Stay tuned for the public API in the first half of 2015 which will allow swapping-in a scheduler implemented by an ecosystem partner or even your own custom implementation. Nevertheless, regardless of the underlying scheduler implementation, the interface to the app remains consistent, meaning that the app remains 100% portable. The above just scratches the surface. Like Docker Machine, Docker Swarm is a separate project from the Docker Engine. If you want to learn more about Docker Swarm, including getting your hands on an Alpha build, head on over to its repo.

Transcript of Docker Swarm by Victor Vieux

Page 1: Docker Swarm by Victor Vieux

Docker Swarm!

@aluzzardi - @vieux!

Page 2: Docker Swarm by Victor Vieux

Demo!

us-west! us-east!

Docker!CLI!

Docker!CLI!

Docker!CLI!

=! RAM: 2GB!CPU: 1core!

Page 3: Docker Swarm by Victor Vieux

Demo!

us-west! us-east!

=! RAM: 2GB!CPU: 1core!

Docker!CLI!

Docker!CLI!

Page 4: Docker Swarm by Victor Vieux

Setup!

•  Create a cluster:! $ swarm create

•  Add nodes to a cluster:! $ swarm join --token=<token> --addr=<node_ip>

•  List nodes in a cluster! $ swarm list --token=<token>

•  Start Swarm!

$ swarm manage --token=<token> --addr=<swarm_ip> !!!!

Page 5: Docker Swarm by Victor Vieux

Resource Management!

•  Memory!" "$ docker run -m 1g …

•  CPU!" "$ docker run -c 1 …

•  Ports!" "$ docker run -p 80:80 …

•  More to come, ex: network interfaces!!!!

Page 6: Docker Swarm by Victor Vieux

Constraints!

•  Standard constraints induced from docker info! docker run -e “constraint:operatingsystem=fedora” … " "docker run -e “constraint:storagedriver=aufs” …

•  Custom constraints with host labels!" "docker -d --label “region=us-east” " "docker run -e “constraint:region=us-east” …

•  Pin a container to a specific host!" "docker run –e “constraint:node=ubuntu-2” …

•  More to come, ex: affinity!!!!

Page 7: Docker Swarm by Victor Vieux

Rescheduling!

•  Rescheduling policies; similar to `--restart`!

•  Pending status!

!!!

Page 8: Docker Swarm by Victor Vieux

Swarm scheduler!

2 steps:!!•  1- Apply filters to exclude nodes!

" "- ports!" "- labels!" "- health!

•  2- Use a strategy to pick the best node!" "- bin packing!" "- random!

!!

!!Contributions are welcome ☺ :!

!!!

Page 9: Docker Swarm by Victor Vieux

http://github.com/docker/swarm!

@aluzzardi - @vieux!

Thank You.!