Containers are amazing! 🤘
For new-comers, I suggest going through about all-things virtualization in this article.
Here I wanted to share a really quick way how to get 3-node docker containers up and operational in just few minutes. There are many options to what we can use as our platform. Such include play-with-docker.com or using docker-machine that requires VirtualBox or even running Docker in
IaaS Cloud (Docker CE for AWS, Azure, Google Compute).
So what did i chose? Neither. I went with my all-time-favourite VPS provider. Well.. I do tend to mostly go with some unortodox unfoldings. “Fury Roads”, if you will.
DigitalOcean vs AWS debate as to which extent “cloud” services are provided by both is def. on my list for future disc. Lets just say that, at the moment, market’s supply meets target group’s demand at an increasing rate.
When creating droplets, choose the nearest server location and include own SSH key (bear with me as to why).
At local machine it is easiest to pre-configure ssh connections so that we save time. Just create a file named
~/.ssh folder and use nano or vim to define ssh connections. In my case, I used naming as: node1, node2, node3.
It just seems less hassle by typing:
$ ssh node1
$ ssh -i ~/.ssh/id_rsa -p 22 [email protected]
especially if intending to play with these droplets for longer period of time.
Docker Install & Config
This is an easy one. Check this script.
$ curl -fsSL get.docker.com -o get-docker.sh $ sh get-docker.sh
Lets create docker swarm and setup roles for our three new nodes.
$ docker swarm init --advertise-addr 126.96.36.199 $ docker swarm join-token manager
Copy this token and assign to
node1 we have access to some priviledged commands such as updating roles (manager-to-worker and vise-versa).
$ docker node update --role manager node2 $ docker node update --role manager node3
And now lets create service and run simple “Google DNS ping” task.
docker service create --replicas 3 alpine ping 188.8.131.52
Any additional scalling can be managed from our
node1. The creation of fully operational swarm cluster is completed. Simple as that.