Now a days, SAP construct most of the product as Docker components to have micro-service architecture and to support multi cloud architecture. Dockers are cloud platform independent. This blog is to understand about Docker, Image, container, container registry, Docker Hub, Docker clustering and Kubernetes (K8). Docker is a platform to prepare a container. What is container? What was there before container? Container is a whole package, along with the application, the required dependencies bundled with in it. Before the container, developer or DevOps must install required software, dependencies as a pre-requisite of building the applications. For isolating and organizing the application, the virtualization was used. Kubernetes is not an alternate for docker that will be detailed here.
Before understanding about all, we should know about the virtualization, containerization life cycle of container, architecture and how & where K8 relates or replace the Docker’s components.
Virtualization isolates and organize the process in virtual way, many applications can be run on same VM and shared hardware system. One hardware system can be split into many that can have their own OS. There will be virtual memory allocated. Either the allocated memory used or not it is based on the consumption. But the memory will not be wasted in container mechanism, whichever the size of the memory requires to run that will be taken from host dynamically. There is no pre allocation.
Containerization is a concept of bundling the application code, configuration files and all its dependencies. Containerization is advanced level of Virtualization, it isolates the process for the specific application, the changes in container will not impact OS or hardware or any other applications running in the same host. The containerization makes sure that the contained application will run on any environment. Each container is an application. Container applications can communicate each other in runtime. This is very much required for Microservice Architecture built applications.
Fast boot, scaling up, load balancing and HA are the features of containers. Docker is a platform to provide the containers. There are many container management and container repository tools/platforms available in market.
Docker is a native container provider, Docker provides Docker Swam, Docker compose, Docker Desktop, Docker hub and Kitematic to support all the life cycle process of create, build, deploy, maintain and running dockers. Google’s GCP also provides Container registry to store the containers, Kubernetes for clustering management of containers. Helm is a tool for maintaining k8 containers.
Docker Engine works like a client- server application, CLI is a docker client and the Docker platform is a server in which there is a Daemon. Docker Daemon is a long running program. Docker client communicates to the server via Rest APIs’.
Docker platform perform the actions based on the request comes from the client. Daemon is an actor/engine to do all the performance behalf of Docker platform. Docker platform contains the images and containers.
When the Docker client executes “docker build” command, the image will be created. The image is nothing but template, we can call it as blueprint of containers. User (Developer/DevOps) can store the images in local repository as well as in public repository like Docker Hub. The images can be reused to create ‘n’ number of instances that is nothing but containers.
The running instance of image is a container. When the docker client executes “docker run” command the instance of image ‘container’ will be created. The container is an actual running application. Once the image created, the containers can spawn from the same image multiple times. The containers are platform independent. Container resolve the version mismatch problem of required dependencies or software. Container will ensure that the same version of software and dependencies will be installed across all environments taring from Dev to Production. We an save time and effort of setting up the same application in all the environments.
This is a repository of all the docker images. There are provided images also. When we want to customize the existing image, we can pull it from registry and customize, again push it back as our own version of image. Docker Hub is a docker registry.
Docker compose is used to make sure that the application exposes the port for other applications to communicate. It can be achieved by running the CLI command “docker-compose -f <YAML or json file name>” up, YAML filename is optional. The file should have details about the services, network and volume required for the application. Docker compose will create separate containers for each application, deploy the applications and make communication easy between the applications.
Docker swarm is a docker management tool which will help the application to be scale up. It provides clustering environment for the containers. Clustering can be achieved using Docker warm by deploying the application in different nodes.
Container registry is another repository where you can store the form of container images. Google cloud, azure provide this. There is no difference between Docker registry and container registry, both used to store the images.
Container Orchestrator does the container management responsibilities such as deployment, scaling, descaling and load balancing. It maintains a cluster of Dockers containers. K8 is a Google’s opensource container management (Orchestration) tool. K8 is not containerization platform like Docker platform (Daemon), but its multi- container management solution. Docker Swam is another solution for container management.
Docker Swam is a container management tool which is from the same native Docker group of tools. Both K8 and Docker Swam are for managing container, but K8 is more familiar and most of the hyper scalers are using it for container management because K8 does auto scaling based on the traffic, hence Docker Swam will not do auto scaling.
K8 has lot of other features,
Restart :- K8 restart the failed containers, mean time it manages with other alternate nodes.
Rollout :- updates the changes made in the application and configurations
Rollback:- In case during rollout something goes wrong, it does auto rollback
Dashboard : There is user interaction support from CLI as well as GUI.
Log & Monitor :- It has in built tools to do logging and monitoring
Kitematic :- Provide GUI support for docker, its legacy. Now Docker provides UI support thru Docker Desktop
Docker Desktop:- Docker support CLI for building docker, to simplify this Docker Desktop(GUI) is used for Windows and MacOS
Helm:- Version controller for K8 application, its maintained by CNCF(Cloud Native Computing Foundation )
Docker makes the developer and DevOps life easy by creating the reusable Docker images, building containers. Docker Hub and Google’s Container Registry helps to store the images for reuse and sharing with others. Docker Swam and K8 manages the containers by providing load balancing, auto scaling, descaling etc. K8 has GUI support for track and monitor the containers, Docker Desktop brings developer work easy while building Dockers. There are other tools available in market to support Docker and Kubernetes like Helm.
Docker and Kubernetes are not alternate for cloud, Kubernetes is not alternate for Docker. With Docker, Kubernetes, cloud, Micro-service architecture, Rest Architecture style and enterprise messaging(Event source) we can bring the next generation application as more powerful.