Docker and Kubernetes

Feb 2024, Ulf Schneider

▦ ▦ ▦

Docker Containers

Docker allows to package software applications into images

The image

The image has everything the application needs to run

code, runtime, libraries, settings, ...

The image can be uploaded to a registry (public and private) for reuse, e.g. hub.docker.com

The image can easily be shared and distributed across platforms (Linux, Win, Mac)

A running instance of an image is a container

Run a web server with a Docker tutorial

  1. docker run --rm -p 4230:80 docker/getting-started
  2. Point your browser to http://localhost:4230/

Multiple containers can be started from a single image

Containers run on different platforms because of virtualization

Virtualization allows a single computer to be divided into multiple virtual computers

What is the difference of a container and a virtual machine?

Docker containers use the hosts operating system

Virtual machines bring their own operating system

Containers reuse the OS Kernel

Compared to a VM, a Docker container

  • needs much less cpu and memory
  • is smaller in size (mb vs. gb)
  • will startup much faster (sec vs. min)

Kubernetes

Kubernetes is a management layer to orchestrate many containers (100s and 1000s)

▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦ ▦

You might as well read and write K8s instead of Kubernetes

How Kubernetes and Containers play together

Kubernetes provides for containerized services

  • high availability
  • scalability
  • disaster recovery

A container inside of Kubernetes is a pod

Kubernetes cluster architecture sketch

⎈ ▦ ▦ ▦

Have fun with containers!