Category Archives: Docker

Developing With Containers

In the last few years, the cloud has completely changed the way we used to think about and design applications. With our eyes taken away from hardware availability, we can think more in terms of scalability and reliability. This has given a rise to microservices based design. Containers further support our idea of microservices based implementations by providing another layer of hardware independence.

What is a container?

Let’s start from the beginning. a decade or so back, when you need to deploy an application, you would go to your hardware department and tell them to get you a new box. So if you are deploying 10 applications, you would end up having 10 different sets of hardware being managed. In all probability, you were using less than half the processing power of a machine your application was deployed on because you would not take a risk of running a production application on a low powered machine.

Then came the era of Virtual machines, which helped us installing multiple virtual machines on the same machine. With the popularity of the cloud, virtual machines got more popular. Now you could easily boot up a virtual machine and deploy your application on that. One pressing downside of a virtual machine is that if you have 4 virtual machines running on a box, that would mean you have an overhead of running 4 operating system which ends up eating a lot of processing power.

This gave rise to the thought process for Containers, which helps us run an application inside its own container rather than an independent physical or virtual machine.

Let’s look at what a container is and how is it different from a VM with help of Docker container technology.

Image source – https://www.docker.com/

What is Docker?

Docker the technology, created by a company namesake, gives us tools to implement the concept of containers. As we can see in the image above, in case of a virtual machine, every virtual box has its independent Operating System image. That would mean that each Virtual machine is somewhat an independent system in itself. On the contrary, Docker installs a Docker engine on top of OS, which can further run multiple containers with a different set of applications.

Here are some useful docker commands

docker run
— Run an image
Docker ps
— Lists down all the running containers
Docker ps -a
— Lists down all the containers
Docker images
— Lists down all the images

More docker commands.
https://docs.docker.com/engine/reference/commandline/docker/

What is Kubernetes?

Running your application using Docker containers is the job half done. In the modern world, you need to take care of problems like how your application will handle the increase or decrease of load? How will we handle a situation when a node is down? Kuberenetes answers these questions helping us orchestrating the nodes and applications. It keeps a check on load and helps us increase or decrease firepower or add/ remove application instances. It takes care of failing nodes and brings in more nodes if required.