How to create a Docker Swarm?

When I say isolate a creating a network around you know a set of docker containers basically creates an isolation layer nobody can talk to these set of docker containers unless specified so now you can have you know multiple sets of docker containers that are connected using you know specific network drivers like these two sets of docker containers might be connected using bridge networks and all of them together might be connected using an overlay network.

You can see how it creates a layer of isolation and you know you can manage these different containers using the network you know overlay network and all the different networks drivers you have all right so let’s talk about docker-compose so for now let’s just understand docker-compose is a service within docker that helps us launch multiple containers at the same time right so normally when you’re running docker containers right you you you use one single command in the Docker CLI and you run one container at a time you can’t keep on doing this if you have to launch a service that has 10 containers.

If you want to test continuously then you might have to remove those containers and launch them again and again and again so you can’t keep on using that one line and this makes it much easier to basically launch multiple containers and you know in deployment time this is especially useful, so people use docker-compose for that purpose now why orchestration at all now guys before I continue this give me two seconds let me just go grab a cup of water so that I don’t remain parched for the rest of this live session all right guys I hope I didn’t make you wait too long yeah I have my cup of a nice cold glass of water next to me now let’s continue with the session now I explained to you a lot of docker concepts.

These concepts are going to help us understand orchestration and you know they are the tools that we will implement while working with orchestration that’s why I explain them to you now let’s start by asking why orchestration in the first place, so orchestration basically allows us to manage and maintain multiple containers this is especially helpful in software development where we may be making use of microservices architecture as it breaks down the software into small manageable chunks having different configurations and environments becomes easier with orchestration.

Let’s take the definition of orchestration itself where have you heard orchestration before you might have heard of you know music operas and you have orchestrators over their right who orchestrate the music so similarly you have orchestrators tools like docker swarm and Kubernetes they basically manage the containers so if those containers were musicians you would have an orchestrator managing them and similarly you have docker swamp tools like sorry docker swarm and community tools that are orchestrators that orchestrate these containers they manage these containers they make sure that they stay up they manage the health and they make sure that different configurations if needed are passed on to these containers etc.

That’s what orchestration is they allow us to manage and maintain multiple containers at the same time and this is especially helpful in software development because you have microservices you have sets of containers you know acting as one single software so if you want to figure out any issues with that software you have multiple containers so you know where to pinpoint so it becomes much easier you can easily scale and descale using you know orchestration also, so this is why we need orchestration in short orchestration helps us better manage our deployed software so what are the benefits of orchestration so I’ve already listed a few let’s talk about them here more.

We have an easy deployment where you can deploy you know your software much more easily you can easily manage these containers you have easy resource management for these containers it allows for health monitoring of these containers when I talk about easy resource management you know you have to allocate certain resources for certain features of an application and to do that you have you make use of orchestration now you want to make sure that not all parts of your software are receiving the same amount of resources now this kind of discrimination is implemented to make sure that the features that have to be best supported at the core of the software is working fine all the time that’s why you have multiple replicas of those you know features and that’s where you make sure that those features have the most amount of resources possible.

It’s again a battle between how many resources that you have and how much they cost to use, so cost-effectiveness also plays into this majorly then you know it allows for a health monitoring of these containers so you have multiple containers now for some reason one container crashes maybe for due to you know some internal issues with the system itself and not with the application then you need to know that happened because it’s these containers are your system so if one part of it fails you should know that one part of it failed otherwise how will you correct it how will you know to replace it, so that’s why health monitoring is important for these containers now load balancing among different containers so when I discuss load balancing here when I mean that you know.

Basically, any task for execution is divided among these containers so let’s say you are running three services and these three services are basically you know necessary integral to the whole uh deployment purpose of your our software now you’re running them on three nodes or three uh infrastructure locations now what happens when one of them fails the no no no no sorry no let’s not talk about that let’s talk about how these three services are launched on these three infrastructure areas now each of them has their own dedicated infrastructure area they get mapped three two three know what happens when one of them fails.

If one of them fails we have to make sure that the service from the one of them that failed moves on to the other two given that those other two can handle the new service the new incoming service why the new incoming service because the third infrastructure failed and we have to you now run the third service somewhere one place or the other, so that’s why load balancing can matter especially when you have to divide tasks load balancing plays into a lot of different uh you know um software facets over here development facets you can load balance in many things it’s especially used in task handling where you you know divide the task based on what kind of resources available to you what kind of servers or you know instances are available to you and you divide the tasks accordingly then comes easy updating when you want to update your whole application with new settings or new features it becomes easy to do so with the help of orchestration easy scaling up and rolling back so depending on the know you so let’s say you have an application.

Leave a Comment