DevOps Engineer · Step 5 of 8 · 10 min

Containers and Kubernetes basics

Build and run a container, and explain what Kubernetes adds on top.

01 · What a container is

A container packages an app with everything it needs to run: libraries, runtime and settings. It runs the same on your laptop, in CI and in production. That ends the old excuse: it works on my machine.

Containers share the host's operating system kernel, so they start in seconds and are much lighter than virtual machines. An image is the packaged template; a container is a running copy of it.

02 · Docker and friends

Docker made containers popular. You write a Dockerfile listing the steps to build an image, then docker build and docker run. Images follow an open standard from the Open Container Initiative, so other tools such as Podman can build and run them too.

Docker Desktop is free for personal use, education and small businesses, but larger companies need a paid subscription. Check your employer's licence. Keep images small, and never bake secrets into them.

03 · What Kubernetes does

Running one container is easy. Running hundreds across many machines, restarting them when they crash and rolling out new versions without downtime is not. Kubernetes is the most common system for this, called container orchestration.

You describe what you want in YAML: run three copies of this image, expose them on this port. Kubernetes keeps reality matching that description. The key words are pod, the smallest unit; deployment, which manages copies and updates; service, a stable address; and the control plane that runs it all.

04 · Do you need it?

Kubernetes is powerful and complex. Many small teams do well with simpler managed options that run containers for them. Learn the concepts because employers ask, but do not assume every project needs a cluster.

05 · Try it

06 · Check yourself

What is the main job of Kubernetes?