Chapter 5. Working with Containers
In the previous chapter, we learned how to build a Docker image and the very basic steps required for running the resulting image within a container. In this chapter, we’ll first take a look at the history of container technology and then dive deeper into running containers and exploring the Docker commands that control the overall configuration, resources, and privileges that your container receives.
What Are Containers?
You might be familiar with virtualization systems like VMware or KVM that allow you to run a complete Linux kernel and operating system on top of a virtualized layer, commonly known as a hypervisor. This approach provides very strong isolation between workloads because each VM hosts its own operating system kernel that sits in a separate memory space on top of a hardware virtualization layer.
Containers are fundamentally different since they all share a single kernel, and isolation between workloads is implemented entirely within that one kernel. This is called operating system virtualization.
The libcontainer README provides a good, short definition of a container:
A container is a self-contained execution environment that shares the kernel of the host system and is (optionally) isolated from other containers in the system.
One of the major advantages of containers is resource efficiency, because you don’t need a whole operating system instance for each isolated workload. Since you are sharing a kernel, there is one fewer ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access