Docker 1.12 Swarm
TL;DR. Docker 1.12: Now with Built-in Orchestration. You orchestrate the Docker hosts as a cluster (or swarm), not the containers that run within the Docker host (that’s the task of resource scheduler like Kubernetes)
More at https://www.youtube.com/watch?v=FgXJKw37po8 and https://blog.docker.com/2016/06/dockercon-part-1-top-10-video/
Tested this Swarm cluster using two Turnkey Linux VMs.
Note: More at https://docs.docker.com/engine/swarm/swarm-tutorial
First node (manager)
- docker swarm init
- docker node ls
ID NAME MEMBERSHIP STATUS AVAILABILITY MANAGER STATUS
14kz2qyngq62o754wb5ufa1ul * core Accepted Ready Active Leader
6pkybnsbepnhrz4deoc1aunv9 core Accepted Down Active
- docker node inspect self
- docker swarm update
ID NAME MEMBERSHIP STATUS AVAILABILITY MANAGER STATUS
14kz2qyngq62o754wb5ufa1ul * core Accepted Ready Active Leader
6pkybnsbepnhrz4deoc1aunv9 core Accepted Down Active
- docker node rm 14kz
Error response from daemon: rpc error: code = 9 desc = node
14kz2qyngq62o754wb5ufa1ul is a cluster manager and is part of the quorum. It must be demoted to worker before removal
- docker node rm 6pky
Error response from daemon: rpc error: code = 9 desc = node
6pkybnsbepnhrz4deoc1aunv9 is not down and can’t be removed
- docker node ls
ID NAME MEMBERSHIP STATUS AVAILABILITY MANAGER STATUS
14kz2qyngq62o754wb5ufa1ul * core Accepted Ready Active Leader
6pkybnsbepnhrz4deoc1aunv9 core Accepted Down Active
774skgsihm3w1bkd8dttejud6 core Accepted Ready Active
- docker service create
Example:
docker service create — name vote -p 8080:80 instavote/vote
Output:
7k792z653eycsp7x75hubw5t7
Only the Swarm manager can create a Docker service
- docker service tasks <ID>
Example:
docker service tasks 7k79
- docker service scale vote=6
- docker service update - -image instavote/vote:movies vote
Second node (worker)
- docker swarm join IPaddress:port
where IPaddress of manager, default port is 2377
Example:
docker swarm join 192.168.0.133:2377
- docker node inspect self
Error response from daemon: This node is not participating as a Swarm manager
- docker swarm leave
- docker swarm join 192.168.0.133:2377
Error response from daemon: This node is processing an existing join request that has not succeeded yet. Use “docker swarm leave” to cancel the current request.
- docker swarm update
If a node is already part of a Swarm cluster or if there is a pending request to join a cluster, use docker swarm update to make a node ready.
- docker node ls
Error response from daemon: This node is not participating as a Swarm manager
- docker swarm join 192.168.0.133:2377
This node joined a Swarm as a worker.
Networking
- Docker uses libnetwork, Kubernetes does not
- by default, libnetwork makes use of Linux-Bridge and IPtables.
- libnetwork provides built-in IP address management, native multi-host networking, and native service discovery
- libnetwork defines the Container Network Model itself
- as of the Docker 1.12 release, Docker now integrates native load balancing, also pulled in from the Linux kernel, by way of the IPVS (IP virtual server)
- Docker 1.12 now also benefits from a routing mesh powered by Gossip protocol.
- macvlan capability enables Docker engine to more easily join an existing physical or virtual network.
Do you want to be a developer, and sustain a fun and meaningful IT Marketplace? Just click HERE.