I recently started learning docker and it seems that most of the heavy lifting is done by the Linux kernel, using namespaces and cgroups.
A few things which I am finding confusing are:
What is the difference between a namespace and a cgroup? What are the different use cases they address?
What has docker implemented on top this these to gain popularity ?
I would like to know the internals of these features and how they are implemented.
Control Groups (cgroups) are a feature of the Linux kernel that allow you to limit the access processes and containers have to system resources such as CPU, RAM, IOPS and network. In this lab you will use cgroups to limit the resources available to Docker containers.
There are 6 types of namespaces: 1.
Cgroups allow you to allocate resources — such as CPU time, system memory, network bandwidth, or combinations of these resources — among user-defined groups of tasks (processes) running on a system.
Docker uses namespaces of various kinds to provide the isolation that containers need in order to remain portable and refrain from affecting the remainder of the host system. Each aspect of a container runs in a separate namespace and its access is limited to that namespace.
The proper links for those two notions have been fixed in PR 14307:
Under the hood, Docker is built on the following components:
The cgroups and
namespaces
capabilities of the Linux kernel
With:
In short:
See more at "Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic" by Jérôme Petazzoni.
Cgroups involve resource metering and limiting:
Namespaces provide processes with their own view of the system
Multiple namespaces:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With