DEV Community

Gokul Kannan
Gokul Kannan

Posted on Edited on

Docker and Kubernetes

Your app depends on a specific language version, libraries and settings, and the next machine is always a little different. Docker packages your app together with everything it needs into one box that runs the same way everywhere: your laptop, a teammate’s laptop, a test server, the cloud.

Three Ways to Run an App:

Bare metal: one server, one app
Run two apps on the same server and they start to fight: app A needs Python 3.8, app B needs Python 3.12; one upgrade breaks the other. So companies bought one server per app, and most servers sat idle most of the day.

Virtual machines: a computer inside a computer
A hypervisor (VMware, VirtualBox, KVM) splits one physical server into several pretend computers. Each VM has its own operating system, so apps no longer fight. But every VM carries a full OS (gigabytes of disk and RAM) and takes minutes to boot.

Containers: just enough isolation
A container doesn’t pretend to be a whole computer. It’s a normal process on the host that Linux gives a private view: its own files, network and process list, plus limits on CPU and memory. All containers share the host’s kernel, so there’s no extra OS to boot.

Kernel = the core of the operating system that talks to the hardware. Containers on one host share the same Linux kernel. That’s why a Linux container needs a Linux kernel underneath, and why Docker Desktop runs a small Linux VM on Windows and macOS.

Image

a read-only template: app + libraries + settings

Analogy Eg: a recipe, or a class in programming

Container

a running instance of an image

Analogy Eg: the cooked dish, or an object made from a class

Registry

a store for images, like Docker Hub

Analogy Eg: an app store

One image can start many containers, just like one recipe can feed many plates.

Kubernetes: once you have many containers on many machines, someone has to start them, restart them when they crash, and spread them out. That’s Kubernetes.

Content Ref: https://godisai.in/

Top comments (0)