ECE344 Fall 2026 (Sec 1) Lec 31 - Containers
Overview
Jon Eyolfson explains containers as ordinary Linux processes with isolated views of system resources, using namespaces and cgroups to provide many virtual-machine benefits while sharing one kernel. He demonstrates process and filesystem isolation, resource limits, layered images with copy-on-write storage, and security controls such as capabilities and seccomp, then contrasts containers with virtual machines.
Key takeaways
- A Linux container is a group of ordinary processes sharing the host kernel, with namespaces giving them separate views of resources such as PIDs, mounts, networking, and users.
- Cgroups can cap memory, CPU, and process counts; the lecture demonstrates a 64 MB memory limit and an eight-process limit to contain resource-intensive programs.
- Container images combine read-only layers through OverlayFS, while each running container gets a writable copy-on-write layer that disappears when the container is removed.
- Container root is not automatically equivalent to unrestricted host root: user-namespace mappings, Linux capabilities, and seccomp filters limit its access to the shared kernel.
- Docker on macOS and Windows needs a Linux kernel, typically supplied by a virtual machine; containers running there share that VM's kernel.
Chapters
- Virtual machines package an application with its dependencies and a guest kernel, but require booting and distributing a whole machine image.
- Containers isolate sets of processes while reusing the host kernel, avoiding guest kernels, virtual CPUs, and boot time.
- Jon Eyolfson frames containers as a lighter way to distribute applications with consistent libraries and files.
- Docker and Podman start containers as processes; options such as `-it` enable an interactive terminal and `--rm` removes the container on exit.
- A container image supplies user-space files and a default command, often Bash, but does not include a Linux kernel.
- A volume mount makes host files available inside the container, while a working-directory option sets its starting location.
- A container can see its own process IDs, filesystem mounts, network, hostname, and user IDs through Linux namespaces.
- The course container runs Debian user-space programs on the host's kernel, which Jon Eyolfson demonstrates by comparing `uname` output.
- On macOS and Windows, Docker Desktop runs a Linux virtual machine whose kernel is shared by the containers.
- A process can have PID 1 inside a PID namespace and a different, larger PID on the host; `/proc/<pid>/status` exposes the namespace PID.
- The container's PID 1 has init-like responsibilities, including reaping child processes; Bash can perform this role in the demonstrated setup.
- `unshare` creates a new namespace for a command, and namespaces can be nested so processes see different PID hierarchies.
- Mount namespaces provide a separate root filesystem, while user namespaces map container IDs to host IDs so container root need not be host root.
- Linux control groups, or cgroups, group processes and can constrain memory, CPU time, and the number of processes.
- The demonstrated cgroup settings use `memory.max`, `pids.max`, and `cpu.max` to configure resource limits.
- Systemd also uses cgroups to keep service processes grouped, allowing a service's processes to be managed together.
- A memory-allocation demo writes to each allocated 16 MB chunk, forcing Linux to commit memory rather than leaving the allocation untouched.
- With a 64 MB cgroup limit, the process is killed after reaching the limit; the kernel log records the cgroup out-of-memory event.
- A process limit of eight makes a fork-bomb-style test fail to create more processes, demonstrating how cgroups protect shared machines.
- `podman history` shows the commands and sizes of image layers, from a Debian base image to added tools such as GCC and Valgrind.
- OverlayFS combines layers into a single visible root filesystem, with later layers adding or modifying files from earlier ones.
- Image layers are mostly files plus metadata; the container image does not contain the kernel.
- A running container adds a writable upper layer above the image's read-only layers.
- New files go into the upper layer, and modifying a lower-layer file copies it up first, applying copy-on-write at file granularity.
- The container diff reports added, changed, and deleted files; deleting a lower-layer file uses a whiteout marker, and removing the container discards its writable changes.
- Containers share the host kernel, so a kernel vulnerability could undermine container isolation.
- Linux capabilities divide root privileges into specific permissions, letting runtimes remove powers such as changing host settings or binding privileged ports.
- Jon Eyolfson demonstrates that changing a hostname or binding a server to a privileged port can fail when the required capability is absent.
- Seccomp applies a filter to system calls, allowing a call, returning an error, or terminating the process based on the call and its arguments.
- The filter is a BPF program; processes can make filters stricter, and child processes inherit them.
- A demo allows `mkdir` before installing a filter, then blocks a later directory-creation call; Podman also applies a default seccomp profile.
- Containers generally start faster than virtual machines on Linux because they reuse the running kernel instead of booting a guest kernel.
- A Debian or Alpine container base supplies user-space programs and libraries, not a complete operating system kernel.
- Jon Eyolfson summarizes the course container as six image layers, isolated namespaces, cgroup limits, mapped user IDs, and restricted capabilities and system calls.
Transcript excerpt
1:41 I >> All righty, welcome back to operating
3:48 systems. We get to talk about containers. You've been using them all semester, right? Docker, everything. You had no idea how it worked. They were magical. Now we can finally explain it. Also, well, no, let's just get into it. So, we we're talking about virtual machines last lecture that ran a whole kernel each. We said it was a good idea for distributing an application. If you distribute an application, all of its libraries at once, then everything's consistent. You can update your main system, not take down anything, and also have the benefits of moving virtual machines across computers and all of that stuff. All you supply someone is a disk image, and they can run everything consistently. The only drawback is, well, it runs as a whole virtual
4:34 machine, and you have to distribute a kernel along with your application. So, that's a lot if you just want to freeze one application's dependencies. So about if we could reuse one kernel to isolate processes from each other instead, much in the way virtual machines let us do, have all that power without having a full virtual machine. So, that's where containers come in. So, on the left, that 's what would happen if we have three virtual machines. Let's just assume these three virtual machines are running three different applications. So, we have a set of processes for each one that have their own kernel. The hypervisor controls the hardware, and these processes are not aware, even remotely aware, that other processes are running on different machines. They can have different
5:22 versions of the same library, all of that fun stuff, right? Any questions about that? Oops, that is the wrong button. So, with containers, it's more like what we're used to. So,
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Jon Eyolfson.