Linux namespaces
lastmod 2023-06-30created 2021-06-2814 edits
Namespaces are a feature of the Linux kernel that partitions kernel resources so that one set of processes sees one set of resources while another set of processes sees a different set of resources.
About
A namespace is a lightweight virtualization technology that runs on a single system but provides isolated environments as if each were a separate, independent space.
Features
The namespaces currently supported by Linux are as follows:
- Cgroup Namespace (cgorup)
- IPC Namespace (ipc) - Isolates inter-process communication
- Things like Unix Domain Socket (UDS)
- Partitions information related to network resources, such as Network interface and iptables
UTS
- [Recommended] Hostname isolation using UTS namespaces - Container networking basics part 1 | 44BITS 1
UTS (UNIX Time-Sharing) namespaces allow a single system to appear to have different host and domain names for different processes. "When a process creates a new UTS namespace ... the hostname and domain of the new UTS namespace are copied from the corresponding values in the caller's UTS namespace."
Building your own Docker with Linux Namespaces, cgroups, and chroot
- Build Your Own Docker with Linux Namespaces, cgroups, and chroot: Hands-on Guide | Akash Rajpurohit
- GN⁺: Build your own Docker using Linux namespaces, cgroups, and chroot. | GeekNews
Docker is a leading containerization platform that uses Linux namespaces, cgroups, and chroot for isolation, resource management, and security.
- This guide offers a hands-on opportunity to experience the core technologies behind Docker.
- This guide walks through the steps of building a basic container environment from scratch.
Steps:
- Set up new namespaces using the unshare command.
- Configure cgroups to manage resource allocation and control usage.
- Build a root file system using debootstrap.
- Mount the essential file systems and change the root directory using chroot.
- Install and run an application inside the container using the Nginx web server.
By following this guide, software engineers can gain a practical understanding of how a Docker-like environment is built using Linux namespaces, cgroups, and chroot.
Docker offers more features and functionality, but understanding these core technologies is important for creating isolated and efficient environments for applications.
See also
- Linux
- Docker:Network
- veth - Linux virtual Ethernet interface
Favorite site
- Wikipedia (en) Linux namespaces
- Linux Namespace :: Las Scribble Pad
- What is a Linux Namespace? | 44BITS
Tutorials
- Linux namespace
- Linux namespace - UTS
- Linux namespace - IPC
- Linux namespace - PID
- Linux namespace - NS (File System)
- Linux namespace - NET
References
-
44bits_-_container-network-1-uts-namespace.pdf ↩