1.What is Docker?
Docker is a container technology introduced in 2013 by the eponym company, there are an Enterprise edition and a Community edition which is sufficient in most cases.
A container is a way to operate system virtualization to run an application. You can easily package your application code, its configurations and dependencies. Then you can build and run this image quickly everywhere. It is build on the chroot linux command and the cgroups technology. The first one enables a directory to be considered as the root directory, thus it isolates a process from the rest of the system. The second one limits its resources.
Docker is often referred as the “new Virtual Machines” as containers are lighter and faster. The main reason is the lack of the Guest Operating System inside a container.
The containers, and so as Docker, enables teams to bridge the gap between the development, validation and production environments, as it helps prevent from the famous “it works on my machine”. Furthermore, as it uses less resources, it’s easier to scale, light containers can be spin up in few seconds.
Docker is not the only containerization technology, we can mention for example CoreOS Rocket, but it’s clearly the leader in its field with a great open source ecosystem.
source: Tech Target
2.What is Kubernetes?
Kubernetes is an orchestration tools publicly released by Google in 2014 and mainly inspired by an internal tool called Borg, a cluster management system enabled to handle thousand of jobs. It’s a big open source project as it’s part of the Github top 10 project and more than 2000 people have contributed to it. Furthermore, there is a huge eco-system around Kubernetes led by the Cloud Native Computing Foundation with monitoring tools like Prometheus, logging tools like Fluentd or a package manager like Helm.
Keeping containers alive is hard and that is the reason for life of Kubernetes. As it’s declarative a number of container instances is required, if a container crashes, a new one is automatically created and thanks to a powerful auto-discovery feature, integrated to the cluster networks. Moreover it enables you to make canary release, or rolling updates easily, and so the 0 downtime objective becomes more achievable.
Other orchestrators exist, like Docker Swarm, but they are not as powerful as Kubernetes. Their secrets manager or their load-balancing services are not as complete as Kubernetes ones. Besides, all major cloud providers as AWS, Google Cloud Platform or Azure offer a managed service for Kubernetes.
3. Using Docker and Kubernetestogether?
A way to visualise the link between Docker and Kubernetes is to look at a deployment file:
- name: nginx
This file describes a part of the Kubernetes cluster, including for example the number of replicas, so the number of pods running. Below the containers directive, we find the image one, which is the reference to the docker container which runs inside a pod.
To sum it all, Docker and Kubernetes do not serve the same purpose : Docker helps you to develop, deploy and so iterate faster on your product whereas Kubernetes is the solution to run them safely in production.