Skip to content
Search

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
  • Network Namespace
  • Mount Namespace - Partitions and isolates file system mount points
  • PID Namespace - Partitions and manages PIDs (Process IDs)
  • UTS Namespace - Changes and partitions the hostname
  • USER Namespace - Partitions and isolates user and group IDs
  • Time Namespace

UTS

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

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:

  1. Set up new namespaces using the unshare command.
  2. Configure cgroups to manage resource allocation and control usage.
  3. Build a root file system using debootstrap.
  4. Mount the essential file systems and change the root directory using chroot.
  5. 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

Favorite site

Tutorials

References


  1. 44bits_-_container-network-1-uts-namespace.pdf ↩

author Zer0 sitemap