Monday, July 16, 2018

Docker Playground : Simplest way to Test - Deploy & Scale of Containers on Docker Swarm

Dockers & Containers have pretty much entered into every Developer or IT Ops daily life. Docker provides an easy way to create Docker Images of applications using DockerFile and then test these application images by running containers.

Testing applications using containers is quick and easy but the real challenge is when Testing - Deploy & Scale of applications on Cluster. This is the real production level scenerio is.

One way to do these kind of Testing is to set up Docker Swarm Cluster manually on IaaS. You can refer to my earlier post Multi Node Swarm Cluster on Oracle Cloud Infrastructure Classic . The posts describes how to configure Swarm Cluster on OCI-C. Same can be used for different Cloud Service Providers. The other option is to Use managed Container Cluster Services provided by Cloud Service Providers.

The problem with above two approaches is that they will charge you not much but some $$. The above methods are good option if you want persistent Cluster to be there for testing your workloads.

But if you just want to test your container services on cluster's as well as test scaling of these services, there is a simple way out.

Thanks to Docker Play Ground : Play With Docker




This Virtual Docker Environments gives you easy access. With this platform, you can set up Nodes with Installed Dockers - Docker Hosts. You can set up Single Nodes as well as Multi Node Swarm Cluster.

The only catch here is that Nodes Last for 4 hours only - which is fair amount of time to test your containers and applications.



If we click on Add New Instance - It will add a new Instance - Standalone Host.


You can access this shell with root access.



There is a Beautiful Text Editor provided where you can directly edit all your files. Let us test this.

Create a simple file test.txt under root. After that Click EDITOR Button.



Now comes the Good Part. There are predefined templates which lets you set up Multi Node Docker Swarm Cluster. Click on the ICON as below



If we select first template with 3 Managers & 2 Workers Node, we will get a Swarm Cluster with the same Configuration. Below, it creates 5 nodes swarm cluster with 3 managers nodes and 2 worker nodes.




Now lets create a service with 3 replicas.

$docker service create --replicas 3 -p 80:3000 rohanwalia/node-web-app




It also publishes the Exposed Port at the top. In this Case 80. Just Click on that port and you can connect to your application.



Cool !!

6 comments: