Contents
What is namespace and cgroups?
Namespaces and cgroups are the building blocks for containers and modern applications. Namespaces provide isolation of system resources, and cgroups allow for fine‑grained control and enforcement of limits for those resources. Containers are not the only way that you can use namespaces and cgroups.
How does network namespace work?
A network namespace is logically another copy of the network stack, with its own routes, firewall rules, and network devices. By default a process inherits its network namespace from its parent. Initially all the processes share the same default network namespace from the init process.
What is namespace and cgroups in Docker?
cgroups limits the resources which a process or set of processes can use these resources could be CPU,Memory,Network I/O or access to filesystem while namespace restrict the visibility of group of processes to the rest of the system.
What is a network namespace What is it used for?
A network namespace is a logical copy of the network stack from the host system. Network namespaces are useful for setting up containers or virtual environments. Each namespace has its own IP addresses, network interfaces, routing tables, and so forth.
How are namespaces implemented in Linux in cgroups?
Currently Linux implements six different namespaces: For example while implementing network namespaces, the function CLONE_NEWNET is an identifier in the code where the network namespace is created.Namespaces can be implemented with API calls. These APIs consist of the following functions: -creates a new process and a new namespace.
How to create a namespace on a network?
A network namespace is logically another copy of the network stack, with its own routes, firewall rules, and network devices. To create a network namespace: On the terminal window run: For example : ip netns add test : creates a network namespace by the name of test.
What do control groups do in Ubuntu Linux?
Control groups (cgroups) are a kernel mechanism for grouping, tracking, and limiting the resource usage of tasks/processes… There are a few key terminologies one must understand to implement cgroups. I will try not to bore you folks with the bookish language!!
What does a cgroup do in Docker Compose?
Cgroups (control groups) does resource management. It determines how much host machine resources to be given to containers. for example:- we define resources in docker-compose yaml file for creating services like: