liveBook · Manning

Chapter 2: Understanding containers and containerized applications

What you will learn in chapter 2 of Kubernetes in Action, Second Edition

The introduction establishes why understanding containers matters before studying Kubernetes.

After this chapter you will be able to

Section by section

Introduction

The introduction establishes why understanding containers matters before studying Kubernetes.

Key terms: Kubernetes, containers

2.1 Introducing containers

This section explains why running each microservice in its own VM becomes costly and difficult to manage at scale, motivating containers as an alternative.

Key terms: microservices, virtual machine (VM), containers, environment requirements

2.1.1 Comparing containers to VMs

This section compares containers with virtual machines in how they share the host, use resources, start applications, and isolate them.

Key terms: container, host OS, kernel, VM, guest OS, isolation, overhead, system processes, start-up time, application

2.1.2 Introducing the Docker container platform

Explains how Docker packages, distributes, and runs applications, why images are portable and efficient, and where that portability has limits.

Key terms: container image, image registry, container, build, push, pull, registry, image layers, shared layers, copy-on-write (CoW)

2.1.3 Installing Docker and running a “Hello, World!” container

This section shows how to run container images with Docker and explains what happens when a container starts, stops, and uses an image tag.

Key terms: Docker Engine, Docker Desktop, Docker CLI, Docker daemon, Linux VM, docker run, container image, busybox, Docker Hub, local image cache

2.1.4 Introducing the Open Container Initiative and Docker alternatives

This section explains why Docker is not required for container isolation or for running Docker-built images in Kubernetes, using OCI standards and Kubernetes' Container Runtime Interface.

Key terms: Docker, Linux kernel, process isolation, Open Container Initiative, OCI Image Format Specification, OCI Runtime Specification, Container Runtime Interface, CRI, CRI-O, containerd

2.2 Deploying the Kubernetes in Action Demo Application

Introduces Kiada as the demo application that will be built and run with Docker before being used in later Kubernetes chapters.

2.2.1 Introducing the Kiada Application

Introduces Kiada’s purpose and explains how its HTML and plain-text modes retrieve content through different request paths.

Key terms: Kiada, Node.js, client-side JavaScript, Quote, Quiz, RESTful services, plain-text mode, curl, /html, /text

2.2.2 Building the application

This section packages an initial version of the Kiada application as a Docker image and explains how Docker builds that image and its layers.

Key terms: Kiada, container image, Node.js, Dockerfile, FROM, base image, node:23-alpine, COPY, node app.js, -t

2.2.3 Running the container

This section runs the Kiada container, shows how to access its application, and introduces basic commands for inspecting the container and its logs.

Key terms: kiada-container, kiada image, detached, -d flag, -p 1234:8080, localhost, docker ps, docker inspect, container ID, JSON

2.2.4 Distributing the container image

This section shows how to give a locally built container image a Docker Hub-compatible tag, push it to a registry, and run it on another host.

Key terms: Docker Hub ID, tag, image ID, yourid/kiada:0.1, external image registry, Docker Hub, docker login, push, Docker-enabled host

2.2.5 Stopping, resuming, and deleting the container

This section explains how to stop and resume a container, delete a container without deleting its image, and remove unused images.

Key terms: main process, termination signal, stopped container, docker ps -a, container, container image, state, docker rmi, docker image prune

2.3 Understanding containers

Introduces the upcoming explanation of how Linux kernel features enable process isolation without virtual machines.

2.3.1 Customizing the process environment with Kernel Namespaces

Explains how Linux namespaces give container processes isolated views of system resources while allowing selected resources to be shared.

Key terms: Linux Namespaces, Kernel Namespaces, container, process, Mount namespace, Process ID namespace, Network namespace, UTS namespace, network interfaces, default network namespace

2.3.2 Exploring the environment of a running container

This section shows how to inspect a running container and uses process and filesystem views to illustrate its isolation from the host.

Key terms: sh, Linux namespaces, -i, -t, pseudo terminal (TTY), Process ID namespace, PID, process tree, container’s filesystem, container image

2.3.3 Limiting the resources available to a process using cgroups

This section explains how cgroups limit container resource use and how Docker options set CPU and memory limits that the Linux kernel enforces.

Key terms: Linux namespaces, Linux Control Groups, cgroups, --cpuset-cpus, --cpus, --memory, Kernel

2.3.4 Strengthening isolation between containers

This section explains why namespaces and cgroups do not fully isolate containers and introduces ways to restrict what container processes can do.

Key terms: namespaces, cgroups, system kernel, syscalls, elevated privileges, privileged container, syscall, capabilities, drop, principle of least privilege

2.4 Summary

The chapter summary ties together what containers are, how images become running containers, and which Linux features provide isolation.

Where this is used later

Concepts explained in this chapter

← Chapter 1: Introducing Kubernetes Chapter 3: Deploying your first application on Kubernetes →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.