★ wanayoo — archive 1999 https://github.com/docker/libcontainerNouvelle recherche | Portail wanayoo
Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Linux Containers

branch: master

Merge pull request #143 from vishh/enter_cgroup …

Enter cgroups as part of NsEnter
latest commit 29363e2d2d
Victor Marmol vmarmol authored
apparmor Update a few build tags to be more generic, add a couple more SETNS c…
cgroups Cleanup systemd cgroup code
console Fix warnings from go vet
devices Update imports for new docker location
label Add label.InitLabels functioni. Allows generation of labels based on …
mount Fix warnings from go vet
namespaces Cleanup systemd cgroup code
netlink Fix warnings from go vet
network Expose setting interface by fd in network pkg
nsinit Reuse exec cli function and strip nsenter- from funcs
sample_configs Add tests and sample files for selinux and apparmor
security Migrate selinux system xattr calls and prctl calls
selinux Update imports for new docker location
syncpipe Make syncpipe transport generic data
system Implement system.GetClockTicks for all platforms
user Move "pkg/user" into libcontainer and add support for GetUserGroupSup…
utils Fix invalid fd race
vendor Run update-vendor.sh to vendor our deps
.travis.yml Add "update-vendor.sh" script and vendor our current deps (minus Dock…
CONTRIBUTORS_GUIDE.md Update more "dotcloud/docker" refs to "docker/docker"
Dockerfile Add "update-vendor.sh" script and vendor our current deps (minus Dock…
LICENSE Add licensing information
MAINTAINERS Add myself as maintainer.
MAINTAINERS_GUIDE.md Require two LGTMs for non-maintainer changes.
Makefile Fixing a copy-cat from original PR.
NOTICE Add licensing information
PRINCIPLES.md Grammatical improvements
README.md Add travis status badge
ROADMAP.md Correct links to libcontainer issues
api_temp.go Fix nsinit function to get stats from systemd
config.go Update api proposal
config_test.go Update api proposal
container.go Add Exec to container API
factory.go Use conventional factory terminology
process.go Update api proposal
state.go Update cgroups paths in state to be a map with cgroup type as key and…
types.go Do not mark any network stats as 'omitempty' since the value '0' is l…
update-vendor.sh Add "update-vendor.sh" script and vendor our current deps (minus Dock…

README.md

libcontainer - reference implementation for containers Build Status

Note on API changes:

Please bear with us while we work on making the libcontainer API stable and something that we can support long term. We are currently discussing the API with the community, therefore, if you currently depend on libcontainer please pin your dependency at a specific tag or commit id. Please join the discussion and help shape the API.

Background

libcontainer specifies configuration options for what a container is. It provides a native Go implementation for using Linux namespaces with no external dependencies. libcontainer provides many convenience functions for working with namespaces, networking, and management.

Container

A container is a self contained execution environment that shares the kernel of the host system and which is (optionally) isolated from other containers in the system.

libcontainer may be used to execute a process in a container. If a user tries to run a new process inside an existing container, the new process is added to the processes executing in the container.

Root file system

A container runs with a directory known as its root file system, or rootfs, mounted as the file system root. The rootfs is usually a full system tree.

Configuration

A container is initially configured by supplying configuration data when the container is created.

nsinit

nsinit is a cli application which demonstrates the use of libcontainer. It is able to spawn new containers or join existing containers, based on the current directory.

To use nsinit, cd into a Linux rootfs and copy a container.json file into the directory with your specified configuration. Environment, networking, and different capabilities for the container are specified in this file. The configuration is used for each process executed inside the container.

See the sample_configs folder for examples of what the container configuration should look like.

To execute /bin/bash in the current directory as a container just run the following as root:

nsinit exec /bin/bash

If you wish to spawn another process inside the container while your current bash session is running, run the same command again to get another bash shell (or change the command). If the original process (PID 1) dies, all other processes spawned inside the container will be killed and the namespace will be removed.

You can identify if a process is running in a container by looking to see if state.json is in the root of the directory.

You may also specify an alternate root place where the container.json file is read and where the state.json file will be saved.

Future

See the roadmap.

Copyright and license

Code and documentation copyright 2014 Docker, inc. Code released under the Apache 2.0 license. Docs released under Creative commons.

Hacking on libcontainer

First of all, please familiarise yourself with the libcontainer Principles.

If you're a contributor or aspiring contributor, you should read the Contributors' Guide.

If you're a maintainer or aspiring maintainer, you should read the Maintainers' Guide and "How can I become a maintainer?" in the Contributors' Guide.

Something went wrong with that request. Please try again.