Best of 2020: How Docker and Kubernetes Work Together

As we close out 2020, we at Container Journal wanted to highlight the five most popular articles of the year. Following is the third in our series of the Best of 2020.

As more and more companies are embracing the cloud-native DevOps journey, it is important to understand how tools such as Docker and Kubernetes enable digital transformation.

As companies migrate their infrastructure and architecture to match the ongoing technology trend of a cloud-native and data-driven era, we’ve seen a rise in interest for cloud computing, containerization and orchestration solutions. When talking about cloud-native, it is hard to ignore names like Docker and Kubernetes, which have revolutionized the way we create, develop, deploy and ship software at scale.

Docker In Action

Docker makes it really easy for developers by helping them run their application in an identical environment without any hassles such as dependencies or OS issues since a Docker container provides its own OS libraries. Before Docker was introduced, a developer would send code to a tester, but because of various dependency issues many times the code couldn’t run on the tester’s machine, yet it worked fine on the developer’s machine.

After the introduction of Docker, things changed: The tester and developer now have the same system running on Docker container, so there is no more chaos—both are able to run the application in the Docker environment without any difficulties or differences in dependencies.

Build and Deploy Containers With Docker

Docker helps developers create and deploy software within containers. It’s an open source tool that allows you to “Build, Ship, and Run applications, Anywhere.”

With Docker, you can create a file called a Dockerfile. Dockerfile then defines a build process, and when fed to the ‘docker build’ command, it will create an immutable image. You can think of the Docker image as a snapshot of the application and its dependencies. When a user wants to start it up, they use the ‘docker run’ command to run it anywhere the docker daemon is supported and running.

Docker also has a cloud-based repository known as Docker Hub. You can use Docker Hub as a registry to store and distribute the container images you build.

Kubernetes in Action

In a Docker cluster environment, some tasks need to be taken care such as scheduling, communication and scalability. These tasks should be handled by an orchestration tool such as Kubernetes, which is one of the most popular projects in open source history.

Kubernetes is an open source container orchestration tool. It handles the main container management responsibilities including container deployment, scaling, healing and load balancing of containers.

Kubernetes is defined by states, not processes. After defining a pod, Kubernetes works to ensure it is always running. If a container goes down or is killed, it tries to start a new one. If a replication controller is defined with three replicas, it will always try to run that number, starting and stopping containers as necessary.

Docker and Kubernetes Work Together

Docker helps to “create” containers, and Kubernetes allows you to “manage” them at runtime. Use Docker for packaging and shipping the app. Employ Kubernetes to deploy and scale your app. Startups or small companies with fewer containers usually can manage them without having to use Kubernetes, but as the companies grow, their infrastructure needs will rise; hence, the number of containers will increase, which can be difficult to manage. This is where Kubernetes comes into play.

When used together, Docker and Kubernetes serve as digital transformation enablers and tools for modern cloud architecture. Using both has become a new norm in the industry for faster application deployments and releases. While building your stack, it is highly recommended to understand the high-level differences between Docker and Kubernetes.

Let containers help to unhitch the mysteries of cloud computing regardless of the cloud journey you choose.

Let’s take a simple scenario of a CI/CD setup using Docker and Kubernetes:

  1. The developers’ code is pushed into the Git.
  2. The build and test happen with Maven in Jenkins for C.
  3.  Using Ansible as a deployment tool, we will write Ansible playbooks to deploy on AWS.
  4. We will introduce JFrog Artifactory as the repository manager after the build process from Jenkins; the artifacts will be stored in Artifactory.
  5. Ansible can communicate with Artifactory, take the artifacts and deploy them onto the Amazon EC2 instance.
  6. The SonarQube can help in reviewing the code and will give static code analysis.
  7. We then introduce Docker as a containerization tool. Just like the way we did on Amazon EC2, we will deploy the app on Docker container by creating a Docker file and Docker images.
  8. Once this above setup is done, we will introduce Kubernetes to create a Kubernetes cluster, and by using Docker images, we will be able to deploy.
  9. Finally, we will use Nagios to monitor the infrastructure.


Microservices help companies convert large monolithic applications into smaller components so they can package and deploy them separately without any dependency. Microservices give apps more agility, scalability and resilience—with microservices, apps can be updated, changed and redeployed faster.

That is where tools such as Docker and Kubernetes work together to help companies deploy and scale applications as necessary.

Kubernetes has been spreading like wildfire in the cloud market, and the adoption is increasing every year. Companies including IBM, Amazon, Microsoft, Google and Red Hat offer managed Kubernetes under the containers as a service (CaaS) or platform as a service (PaaS) model. Many global companies are already using Kubernetes in production on a massive scale.

Docker is also a fantastic piece of technology. According to the “RightScale 2019 State of the Cloud Report,” Docker is winning the container segment, with a tremendous year-over-year adoption growth.

Millions of developers are dependent on Docker, downloading 100 million container images a day, and more than 450 organizations have adopted Docker Enterprise Edition, including some of the biggest enterprises in the globe. Many more years to come, Docker and Kubernetes are not going anywhere.

Pavan Belagatti

Pavan is a DevOps influencer and a contributing author at various technology platforms. He talks about cloud-native technologies and digital transformation strategies.

Pavan Belagatti has 3 posts and counting. See all posts by Pavan Belagatti