Sunday, September 10, 2017

Hands-on Docker 1.12

Docker 1.12: They introduced with many features, mainly docker engine with in-built orchestration. 
When I worked in previous  docker engine the configuration part was very complex. I need to install and configure manually Docker engine, service registry and discovery, load balance, etc.,  Now I no longer have to install an external discovery service (consul, etcd, zookeeper) or a separate scheduling service. TLS is configured end-to-end out of the box, there is no "insecure mode". There is no doubt in my mind that the new Docker Swarm is the quickest way to get a production-ready docker-native cluster up and running. It is very simple and user friendly. 
I tested single master and single node Docker swarm cluster. New Architecture of Docker 1.12


Creating Swarm master 
=======================
root@docker-swarm-master-secondary:~# docker swarm init --listen-addr 192.168.109.5:2377
Swarm initialized: current node (cq27v0fz0ch53z4evtov8rwpt) is now a manager.
root@docker-swarm-master-secondary:~# docker node ls
ID                           NAME                                       MEMBERSHIP  STATUS  AVAILABILITY  MANAGER STATUS
cq27v0fz0ch53z4evtov8rwpt *  docker-swarm-master-secondary.localdomain  Accepted    Ready   Active        Leader

Adding worker node to the cluster
===========================
root@container-node2:~# docker swarm join --listen-addr 192.168.109.8:2377 192.168.109.5:2377
This node joined a Swarm as a worker.

on Master
==========
root@docker-swarm-master-secondary:~# docker node ls
ID                           NAME                                       MEMBERSHIP  STATUS  AVAILABILITY  MANAGER STATUS
600n95at82b1vvwk3bex5fuo5    container-node2.localdomain                Accepted    Ready   Active
cq27v0fz0ch53z4evtov8rwpt *  docker-swarm-master-secondary.localdomain  Accepted    Ready   Active        Leader


Testing Sample WEB APPLICATION
===============================

Creating Webpage Service
----------------------------------------
root@docker-swarm-master-secondary:~# docker service create --name webpage --publish 80:80 sixeyed/docker-swarm-walkthrough
9i9a4kdj56sot50lbyoxxwbbf

root@docker-swarm-master-secondary:~# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

root@docker-swarm-master-secondary:~# docker service ls
ID            NAME     REPLICAS  IMAGE                             COMMAND
9i9a4kdj56so  webpage  1/1       sixeyed/docker-swarm-walkthrough

Checking Service configuration in readable format
-----------------------------------------------------------------------
root@docker-swarm-master-secondary:~# docker service inspect webpage --pretty
ID:             9i9a4kdj56sot50lbyoxxwbbf
Name:           webpage
Mode:           Replicated
 Replicas:      1
Placement:
 Strategy:      Spread
UpdateConfig:
 Parallelism:   0
ContainerSpec:
 Image:         sixeyed/docker-swarm-walkthrough
Resources:
Reservations:
Limits:
Ports:
 Name =
 Protocol = tcp
 TargetPort = 80
 PublishedPort = 80

Displaying task details of webpage service
--------------------------------------------------------------
root@docker-swarm-master-secondary:~# docker service tasks webpage
ID                         NAME       SERVICE  IMAGE                             LAST STATE         DESIRED STATE  NODE
b5p34exnmp49n7wjzzp1llgdh  webpage.1  webpage  sixeyed/docker-swarm-walkthrough  Running 2 minutes  Running        docker-swarm-master-secondary.localdomain

Creating one more Replica for the service(scaleup)
---------------------------------------------------------------------
root@docker-swarm-master-secondary:~# docker service update --replicas 2 webpage
webpage
root@docker-swarm-master-secondary:~# docker service tasks webpage
ID                         NAME       SERVICE  IMAGE                             LAST STATE           DESIRED STATE  NODE
b5p34exnmp49n7wjzzp1llgdh  webpage.1  webpage  sixeyed/docker-swarm-walkthrough  Running 3 minutes    Running        docker-swarm-master-secondary.localdomain
03bawni3ynq654p7snhucugvj  webpage.2  webpage  sixeyed/docker-swarm-walkthrough  Preparing 9 seconds  Running        container-node2.localdomain

For more details about docker 1.12
https://blog.docker.com/2016/06/docker-1-12-built-in-orchestration/

No comments:

Post a Comment

AWS Autoscaling demo lab Configuring VPC, Public/Private subnets, Internet Gateway (IGW), NAT gateway, etc.,   Crea...