Tech Insights / Kubernetes vs. Docker

Kubernetes vs. Docker:
What tools should you choose to succeed with containers?

As Kubernetes grows in popularity, organizations ask: “Which is better, Kubernetes or Docker?” This question makes it sound as though the two technologies are interchangeable, but it makes more sense to think of them as complementary. In the simplest terms, Docker is a software platform for creating containerized applications. The Docker runtime can be used to host and run containerized applications manually. Kubernetes (often shortened to K8s) is an orchestrator that automates the process of running containerized, cloud native applications created with Docker or other tools. Companies often use Docker and Kubernetes together. A more apt comparison would be Docker Swarm vs. Kubernetes (more on this later).



What are the differences between Kubernetes and Docker?

Kubernetes
Docker
What does it do? Kubernetes is an orchestration system for running containers. It automates the process of deploying, operating, and scaling containerized applications. Docker is a platform for creating containerized applications. Applications can be run manually using the Docker runtime or via an orchestrator.
Who governs it? Kubernetes was created at Google before being released as open source. The Cloud Native Computing Foundation now hosts the project. The Docker software was created by Docker, Inc., and released as open source in 2013. In 2019, Mirantis acquired Docker’s enterprise business and Docker Engine.
When do you use it in the application lifecycle? Kubernetes is used after an app has been packaged into a container to orchestrate and manage the set of containers that make up the app. Docker is used to package code and dependencies into containers as you build and test applications. The resulting containers can be run using the Docker runtime or another OCI-compliant runtime.
How does it work? Kubernetes groups together containers that make up the same application. Each container needed for an application may have multiple replicas, and incoming requests are distributed by load balancers across the replicas. Kubernetes oversees the containers that make up each running application, making sure that they operate properly as they are deployed. Docker packages up application code along with required dependencies, such as libraries, files, and necessary configurations, into a single image that can be deployed manually or using an orchestrator like Kubernetes.



What is Kubernetes?

You may be wondering whether there’s a difference between a Docker container and. a Kubernetes container, but that’s not the right way to think about it. Kubernetes is an open source container orchestration platform that helps make containerized applications portable. Kubernetes orchestrates containers created by Docker (or other tools), eliminating most of the manual processes involved in deploying and scaling containerized applications. Kubernetes comes from the Greek word meaning helmsman or pilot. Google created Kubernetes and open sourced the project in 2014 to the Cloud Native Computing Foundation (CNCF), which currently manages it.


Benefits of Kubernetes

Kubernetes offers many advantages to organizations that deploy it:

Take advantage of a large and growing ecosystem
An enormous ecosystem of tools (many of them open source, so they’re free) has evolved around Kubernetes in a short time, helping to address diverse needs and use cases. Some tools help make Kubernetes easier to deploy and use.

Improve developer productivity
If successfully integrated into DevOps processes, teams can achieve significant increases in productivity. Integrations between Kubernetes and developer tools can reduce the complexity of the development environment, shorten release cycles for cloud native software, and improve software quality by streamlining engineering workflows.

Attract the best talent
One way teams can recruit and keep the best developers is to stay on the leading edge of innovation. Kubernetes ranks high among the most-loved and most-wanted platforms in the Stack Overflow Developer Survey 2020. Given the scarcity of tech talent, this can be a big win.

Future-proof apps
All major cloud vendors (e.g., Google, Microsoft, Amazon Web Services, and others) support Kubernetes and offer services for it. Although other container orchestration solutions exist, they lag behind Kubernetes in market share, cloud vendor support, and the size and growth of their ecosystems. In fact, most (if not all) other orchestration solutions are shrinking.

Scale as needed
Kubernetes can scale to support large, distributed systems.

Make apps more reliable and available
Kubernetes can enable high availability for applications. It also enables rolling updates, so software changes can be made without scheduling downtime.

Save money
Depending on the app, Kubernetes is more cost efficient because it requires fewer infrastructure resources. It can scale up applications and their required resources during peak times and scale down infrastructure during less busy times. That means paying less during slow times.




What is Docker?

Docker is a popular, open source container platform with OS-level virtualization and a lightweight application engine. Docker (and containers in general) resolve the problem of code portability in app development. Teams can build, run, and distribute an application in a Docker container to run on Linux, Windows, Macs, and almost anywhere else, on-premises and in the cloud. The Docker environment includes a container runtime as well as build and image management.

A Docker container image is a standardized software package that includes everything you need to run an application: code, runtime, system tools, system libraries, and settings.


Benefits of Docker

Docker delivers the following benefits to IT organizations:

Allows code to work on any machine
A Docker container eliminates the problem of testing code in one environment, and then not having it work in other environments due to different configurations and settings.

Provides teams with a uniform environment
Everyone uses the same Docker container with the same setup, allowing teams to run scripts and establish processes that simplify life for development and operations teams. IT can more easily isolate and eliminate environment issues without needing to know how individual machines are set up.

Offers abundant resources
Teams can store and access a large number of container images for free from Docker Hub or other public or private container registries.

Lowers resource usage
Containers are small (tens of megabytes in size) and use less resources than virtual machines (VM). A container doesn’t require its own OS instance; multiple containers share the same kernel, so a single server can host more containers than VM; a single VM can take the place of a physical server and run many containers.




What are Kubernetes and Docker, respectively, used for?

Because Kubernetes and Docker both involve containerized applications, some confusion has emerged. Making matters worse, Kubernetes is sometimes used as shorthand for a full container environment with both Docker and Kubernetes.

Docker is a platform for building, distributing, and running containers. But, by itself, it’s not well suited for running complex applications consisting of multiple instances of multiple containers. For these types of apps, you also must be able to do the following:

  • Integrate and orchestrate many modular parts
  • Scale up and scale down based on demand
  • Make them fault tolerant
  • Provide communication among containers

Kubernetes is a container orchestrator that works with Docker containers or other OCI-compliant containers. It coordinates clusters of nodes in production—at scale—to accomplish all the tasks listed above. Kubernetes works around the concept of pods, which are scheduling units that can include one or more containers. Multiple instances of each pod are distributed among nodes to provide high availability.




What to keep in mind when using Kubernetes and Docker

Containers and Kubernetes can require significant planning. Here are some common questions asked by those who are just getting started:

How do Kubernetes and Docker relate to each other?

Kubernetes and Docker can be used together, but Kubernetes can also be used without Docker and vice versa. Kubernetes requires OCI-compliant containers and an OCI-compliant runtime environment. Docker creates OCI-compliant containers, as do other solutions such as VMware Tanzu Build Service. The Docker runtime, however, is not OCI-compliant and requires an additional program, dockershim, to run in Kubernetes.

In late 2020, the contributors to Kubernetes announced the deprecation of the Docker runtime. Kubernetes is shifting to the Container Runtime Interface (CRI), which supports a broader set of container runtimes with smooth interoperability between different runtimes.

Because Docker builds an OCI-standard container image, those images will run on any OCI-compliant container runtime. Therefore, developers can continue to use Docker to build, share, and run containers on Kubernetes. The guide, Getting Started with Docker Containers on Kubernetes, explains how developers can get started using Docker and Kubernetes together.

Does Kubernetes use Docker?

As noted above, Kubernetes offers the ability to orchestrate Docker (and other) containers, enabling you to deploy and monitor many Docker containers simultaneously. Kubernetes and Docker are complementary, the two can work together, but neither absolutely requires the other. Docker remains a very popular tool for creating containers, while Kubernetes has become the most popular tool for container orchestration in production.

Is Kubernetes a container?

There’s no such thing as a Kubernetes container, per se. Kubernetes is an open source container orchestration platform, meaning it schedules and automates the management and deployment of containers on Kubernetes clusters across diverse platforms.

When should I use Kubernetes?

Knowing when to use Kubernetes is a matter of scale. Running containers manually may be OK for developers, but running complex, multi-container applications, ensuring availability and scaling by adding multiple container instances quickly creates complexity that increases with the number of containers and host systems. Kubernetes was designed specifically to address the operational concerns of running containers in production. It recognizes the anticipated—and unanticipated—complexities of running containers on different systems and in different environments.

When should I use Docker?

Docker is popular with developers. If your organization has significant investments and expertise in Docker, it makes sense to use it to create OCI-compliant containers whether or not you’re running Kubernetes. However, if you want to automate the container lifecycle, operate at scale, and enhance security by adopting a DevSecOps approach, then you may want to consider a solution such as VMware Tanzu Build Service.

What’s the best way to learn Kubernetes and Docker?

To learn Docker, teams should learn about containers and everything that goes with them. You can find a variety of tutorials, self-guided classes, and more on the Docker educational resources page.

To master Kubernetes, teams have to understand containers and container orchestration. KubeAcademy offers a full range of materials on containers, Kubernetes, and related topics.

What’s the difference between Docker Swarm and Kubernetes?

Although questions comparing Kubernetes and Docker are common, a more apt comparison is Kubernetes vs. Docker Swarm. Swarm focuses on clustering Docker containers and is tightly integrated into the Docker ecosystem, with its own API and CLI. Docker Swarm can orchestrate containers for smaller workloads, but complex application environments benefit from the more extensive capabilities and flexible ecosystem of Kubernetes.

When Mirantis purchased Docker Enterprise (a fully supported and integrated version of Docker) from Docker, Inc. in 2019, it also acquired Docker Swarm. In February 2020, Mirantis committed to continue to support and develop Swarm for at least two years. Swarm remains a part of the open source Docker Community Edition (Docker CE), but its future remains a little uncertain.




Building on Kubernetes with Tanzu

Kubernetes has become essential for companies making the transition to containers and cloud native development. Adding Kubernetes to your infrastructure doesn’t have to add complexity. Building and deploying modern containerized applications is easy with VMware Tanzu. With VMware Tanzu, you can prepare your infrastructure for modern apps with consistent, conformant Kubernetes everywhere, and centralize lifecycle and policy management for all of your Kubernetes clusters, regardless of where they reside.


重要なトピックの最新情報を入手

ニュースレター配信登録

VMware Tanzu Application Platform simplifies and secures the container lifecycle to speed the delivery of modern apps at scale. With its modular, full-stack capabilities, you can embrace DevSecOps and stand up a platform for modern apps that ensures security throughout the container lifecycle. Automatically build a stream of compliant containers. Secure your software supply chain end to end.

VMware Tanzu Labs can help you to transform your teams and your applications, while streamlining operations across multi-cloud infrastructure. Tanzu Labs works with your teams to build apps, modernize apps, and develop platforms while empowering them to learn about Kubernetes and related technologies.

VMware offers KubeAcademy, a free, product-agnostic Kubernetes and cloud native technology education platform. It provides an accessible, self-paced, learning path to advance skill sets along the Kubernetes journey.