
Take a bottom-up look under the hood of containers, exploring namespaces, groups, and overlay file systems, then connect these ideas to Docker and Kubernetes and their pods.
Explore the foundations of containers by starting with namespaces, cgroups, and overlay file systems, then see how Docker and Kubernetes orchestrate containers at scale.
Explore how namespaces create a virtual boundary around an application on a host system, enabling isolation and solving real problems demonstrated through practical examples.
This video gives you a taste of the power of Kernel Namespaces. You will quickly see how they enable isolating processes running on the same host.
This video provides you with a couple of paths you can take from here.
Explore how namespaces provide isolation by tagging processes, letting Potter fans or fitness fans see only their group, a kernel feature that creates separate namespaces and isolates processes.
Demonstrate how namespaces isolate applications by mapping the Potter fans app's Alice and Sam, and fitness fans app's Connie and Brian, to digital equivalents across two apps and two processes.
Create a separate namespace for Claude by cloning Alice’s script and tweaking it, isolating Claude in his own environment so he cannot see the Potter fans.
Learn to create a child namespace, enter its pid namespace from the parent, and observe the child’s processes and resource usage with ps using the enter command.
In this video, we will first understand what Mounting means and what Mount Points refer to. This is critical to understanding why Mount Namespaces exist and how they work
Demonstrate mount namespaces to isolate Potter fans and fitness fans resources, using bind mounts and pivot root to set each area as its own root directory.
Discover how the --mount-proc flag mounts the proc file system to show only processes in the new pid namespace, and how the mount namespace controls mount point isolation.
In this video, we will dig deeper to understand what the "--mount-proc" flag does
This video introduces the idea of Network Namespaces - what they are, what they isolate and why they may be needed.
Learn how the Alpine root filesystem provides the base kernel services for contained application roots, avoiding host copies by using Alpine mini rootfs for Potter fans and fitness fans.
Explore and generalize the concept of namespaces in the Linux kernel to isolate resources across processes. Trace each namespace type—Pet, Mount, Uts, IPC, Net, User—and examine how cgroups regulate resources within namespaces, including memory, CPU, and network bandwidth.
Create new namespaces by selectively isolating resources (pid, uts, ipc, mount) from the parent, while sharing others; explore network isolation, IP addressing, and overlay file systems underpinning containers.
Understand overlay file systems in containers by examining the lower, upper, and overlay layers, how duplicates in the upper layer win, and see a VM demo.
Demonstrate how an overlay file system merges a read-only lower layer with a writable upper layer into a single merged view, using copy-on-write.
Create an overlay file system with multiple lower-layer directories and see how the overlay layer unites lower and upper layers. Understand why overlay file systems exist in the container world.
Demonstrate creating an overlay file system with multiple directories in the lower layer and a single upper directory, yielding a merged view that unions all data for containers.
Explore cgroups, a kernel mechanism, that control memory, CPU, IOPS, and network for apps in containers using groups and subgroups. See a memory limiter demo that enforces per-application limits.
Explore how namespaces and control groups cap memory for a container by running two memory huggers, showing the total stays under a set memory limit.
Explore how cpu cgroups regulate cpu resources for containers, using two simple examples: a database app and a web app, to emphasize concepts over complexity.
simulate a database application inside a container and enforce a 60% cpu cap with a cpu cgroup and namespace.
Demonstrate cpu.shares to allocate CPU across containers: two processes in a database container share a core; then apply a 50% cpu limit to a web app using the same core.
Review how namespaces, cgroups, and overlay file systems isolate and compose containers. Look ahead to deploying and orchestrating containers with Docker and Kubernetes.
In this video, you will see how you can create your own container just using Namespaces and Overlay Filesystem. Then you will see how Docker makes it easy to create the same container.
Explore how Docker images are layered with overlay file systems, using a base image and upper layers to enable efficient reuse of dependencies across containers.
See how the overlay file system lets Docker reuse the base Ubuntu image across containers, using lower, upper, and merge layers to manage dependencies.
Learn how Docker builds images with an overlay file system, creating intermediate images for dependencies and layering them on a base image to optimize reuse and efficiency.
Explore how two Docker images are built for simple Python apps, examine intermediate images, and trace how layering creates the final image from base Alpine, Python, and C++ dependencies.
Explore Docker layering by building app two and reusing Alpine 3.6 and Python 3 from app one. Observe how reversing dependencies adds an intermediate image and affects reuse.
Explore how Docker controls container resources by using cgroups to cap memory and CPU, demonstrating memory and CPU huggers, Docker run limits, and underlying container isolation.
Demonstrates using cpu quota as a hard CPU limit and cpu shares as a non-hard, competition-dependent allocation across two CPUs, including forcing both on the same CPU to show enforcement.
Explore how a Kubernetes pod groups related containers to share resources like IP and IPC, tied by a lifecycle. Understand how pods relate to namespaces, cgroups, and overlay file systems.
Explore how a pod is built from namespaces, creating a pod namespace and two nested namespaces to group containers and share resources like message queues.
Demonstrates creating a pod with two nested containers using namespaces, isolating each container's resources like pid and files while sharing a pod-level message queue.
This lecture explains how Kubernetes runs pods on worker nodes using kubelet and container runtime Docker, and contrasts imperative pod creation with declarative YAML, via Mini Cube and kubectl.
Learn how to create a pod and replica set from YAML files using kubectl apply, and understand how the replica set uses labels and a template to keep pods running.
Identify the core components of the Kubernetes control plane, including the deployment and replica set controllers, controller manager, scheduler, API server, kubelet, and seed, and understand how they coordinate pods.
Explore how cgroups control memory for a pod, using the memory hugger demo with a 50 MB request and 125 MB limit, and observe Kubernetes behind the scenes.
Explore how Kubernetes enforces CPU limits in a pod via cgroups, CFS quotas, and CPU shares, with behind-the-scenes insights.
Review container isolation through namespaces and the overlay file system, and summarize resource control with cgroups, Docker image layering, and Kubernetes basics like pods, deployments, kubectl, and storage concepts.
Learn how user namespaces map UID and GID between a namespace and the host, so a root inside the namespace becomes an unprivileged host user.
Take your knowledge in Containers and Linux to the next level. You don't need to be a Containers or Linux pro. We will start from the basics.
How does this course differ from other courses on the same topic? It will be a perfect complement to the other courses on this topic. The course will take a bottom-up approach, with a strong focus on the core mechanisms that make containers possible - Namespaces, Overlay Filesystems and Cgroups.
Have you ever wondered how Containers work? No, I don't mean just creating a Dockerfile or a Yaml file. Have you ever asked yourself (or others) what are the key mechanisms that enable us to isolate an application or to control how much CPU or Memory it gets?
How is it possible for an application to run on the same physical machine as other applications, yet not know about them? How do technologies like Docker make it happen? For many of us, Containers and Kubernetes Pods are just a black box. But they don't have to be. In this course, you will learn the foundational mechanisms that make Containers possible. We will take an in-depth look at Namespaces, Cgroups and Overlay FS, and understand how they combine to give us Containers.
Hands-on Course : The concepts will be demonstrated with detailed hands-on examples throughout the course. You will have access to a Ubuntu Virtual Machine that I have used for the demos. The course will include a good mix of theory and demos to illustrate the concepts.
Here is what you will learn in this course:
Namespaces: We will start with how Namespaces enable isolation, the key mechanism in containerization. We will take a detailed look at different kinds of Namespaces - PID, MNT, IPC, USER and UTS , with hands-on examples to demonstrate each of these Namespaces.
Overlay Filesystems: Next, we will look at what Overlay Filesystems are, and understand the key role they play in the world of containers. Again, we will see working examples of how to create an Overlay Filesystem and how they enable sharing modules across multiple containers.
Cgroups: We will also take an in-depth look at what Cgroups are, how they enable us to control the amount of resources available to an application. We will create our own Cgroups for controlling the amount of Memory and CPU available to an example application.
Related System Concepts: You will also learn related system concepts such as the Proc filesystem and Mount Points, which will come in handy while understanding the PID and MNT Namespaces.
For the demos, we will use very simple, easy-to-understand examples instead of complex applications. The focus will be on driving home the key concepts in this course.
Docker: Once we have a solid understanding of Namespaces, Overlay Filesystems and Cgroups, we will jump into Docker. We will understand what Docker Images are and how to create one. Then, we will dive deep into how image layering works in Docker, and tie this back to the Overlay Filesystem. There will be detailed working examples to demonstrate how image layering works in Docker and we will peel these images layer-by-layer. Finally, using concrete working examples, we will demonstrate how Cgroups work behind the scenes when we control the amount of CPU or Memory available to a Docker container.
Kubernetes: We will look at the idea of a Pod, why it exists and also create a Pod by just using Namespaces. Then, we will create Kubernetes Pods, and understand other resources such as Replica Sets and Deployments. We will understand what the key components of a Kubernetes Control Plane are and how they come together in helping us orchestrate Pods. Finally, we will demonstrate how Cgroups are again the key mechanism that enable us to control resources available to a Pod, such as CPU and Memory.
This course will keep evolving as I will continue to add more advanced topics and also clarifying videos to existing topics.
Why this Course?
Because basics do not change. Once you have a firm grasp of these foundational concepts, you will be well positioned to learn any container technology of choice with ease and a lot more clarity. In addition, these ideas are used in other areas - for example Cgroups are also used in Virtual Machines. The knowledge you gain from this course will broaden your skill-set. With a solid understanding of how things work under the hood, you will see Containers in new light.
What you need to bring to the table?
Curiosity and Patience. Curiosity to understand how containers work under the hood. I intentionally go slow, specifically in the beginning of the course, setting the stage for the problem that Namespaces solve. You must be patient and understand the problem first, so that you can really appreciate why Namespaces exist and how they work. Once you understand the problem and the story setup that we will use for the most part of the course, you will start to truly appreciate the core concepts.
Pre-requisite background: If you have done some level of programming and can use basic command-line Linux, you are good to go. You are not expected to have any kind of background in container technologies such as Docker or Kubernetes. I will walk you through any related areas such as the Proc filesystem and Mount Points. Also, you do not have to have an in-depth knowledge of Linux. I will provide the required background wherever necessary. It would be beneficial if you can download and use the VM that comes for free with this course.
How should you approach this course?
First, DO NOT try to cram this into a few weeks - more so, if you have not dealt with these topics before. Because we go deep in to these topics, it is important that you pace yourself. Next, carve out time for the individual sections. There are some areas within each of these sections that demand more time. For example, Mount Namespaces is quite detailed and same goes for Image Layering. Take a break on a regular basis, revisit the ideas and let them sink in. Once it clicks, you will find it incredibly rewarding. It is also important that you get your hands dirty with the examples in the demos, and once you get the idea, try out your own examples.
Disclaimer:
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and other countries. Docker, Inc. and other parties may also have trademark rights on other terms used herein. This course is not in any way or form affiliated with, certified, accredited, or endorsed by Docker, Inc.
Kubernetes and the Kubernetes logo are trademarks or registered trademarks of The Linux Foundation in the United States and other countries. The Linux Foundation and other parties may also have trademark rights on other terms used herein. This course is not in any way or form affiliated with, certified, accredited, or endorsed by Kubernetes or The Linux Foundation.