项目作者: cizixs

项目描述 :
Linux namespace demo scripts
高级语言: C
项目地址: git://github.com/cizixs/namespace.git
创建时间: 2016-12-21T08:05:21Z
项目社区:https://github.com/cizixs/namespace

开源协议:Apache License 2.0

下载


namespace

Linux namespace demo scripts. It is create to demostrate linux namespace usage while writing this blog post(Chinese Version).

Usage

container.c

container.c is the main script that creates a child process running /bin/bash which aims to act like a container.

  1. gcc container.c -o container
  2. sudo ./container

join_ns.c

join_ns.c is a utility script that makes current process join an existing namespace.

  1. gcc join_ns.c -o join_ns
  2. sudo ./join_ns /proc/[PID]/ns/[FILE]

NOTE: join_ns.c is copied from setns(2) man page example mainly, and a few edits are made.

Changelog

  • v0.6: add User namespace support, ordinary user in host can run the process and become root in container
  • v0.5: add IPC namespace, isolate inter process communication
  • v0.4: add Mount namespace supprt, container have its own /proc and /tmp directory
  • v0.3: add PID namespace support
  • v0.2: create a child process with isolated UTS namespace
  • v0.1: create a simple child process that shares namespaces with parent