Go to file
Michael Crosby c5a34a6fe2 Allow extra mount types
This allows the mount syscall to validate the addiontal types where we
do not have to perform extra validation and is up to the consumer to
verify the functionality of the type of device they are trying to
mount.

Fixes #572

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-26 15:21:33 -08:00
Godeps *: use coreos/go-systemd/activation for socket activation 2016-02-09 23:44:09 +01:00
libcontainer Allow extra mount types 2016-02-26 15:21:33 -08:00
script update go version to 1.5.3 in dockerfile and cleanup 2016-01-15 10:56:34 -08:00
.gitignore Make runc buildable everywhere 2015-10-12 19:17:58 +08:00
CONTRIBUTING.md Move libcontainer documenation to root of repo 2015-06-26 11:50:46 -07:00
LICENSE Initial commit of runc binary 2015-06-21 19:34:13 -07:00
MAINTAINERS Change my email address 2015-11-10 19:39:50 +03:00
MAINTAINERS_GUIDE.md Update maintainers guide 2015-07-21 10:59:56 -07:00
Makefile Merge pull request #328 from hqhq/hq_build_runc_everywhere 2016-02-25 23:22:00 -08:00
NOTICE Move libcontainer documenation to root of repo 2015-06-26 11:50:46 -07:00
PRINCIPLES.md Move libcontainer documenation to root of repo 2015-06-26 11:50:46 -07:00
README.md Require containerd id as arg 1 2016-02-09 11:20:55 -08:00
checkpoint.go updating usage for runc and runc commands 2016-02-17 09:00:39 -06:00
delete.go updating usage for runc and runc commands 2016-02-17 09:00:39 -06:00
events.go updating usage for runc and runc commands 2016-02-17 09:00:39 -06:00
exec.go updating usage for runc and runc commands 2016-02-17 09:00:39 -06:00
kill.go updating usage for runc and runc commands 2016-02-17 09:00:39 -06:00
list.go adding --format json to list command 2016-02-18 22:07:04 -06:00
main.go updating usage for runc and runc commands 2016-02-17 09:00:39 -06:00
main_unix.go Windows: Remove nsenter dependency 2015-06-28 17:04:16 -07:00
main_unsupported.go Require containerd id as arg 1 2016-02-09 11:20:55 -08:00
pause.go updating usage for runc and runc commands 2016-02-17 09:00:39 -06:00
restore.go Merge pull request #546 from mikebrow/usage-updates 2016-02-17 21:13:22 +05:30
rlimit_linux.go Adjust runc to new opencontainers/specs version 2015-09-15 08:35:25 -07:00
signals.go Check if tty is nil in handler 2016-02-17 13:20:22 -08:00
spec.go Handle memory swappiness as a pointer to handle default/unset case 2016-02-24 09:02:06 -06:00
spec_test.go Fix CgroupsPath interpretation 2016-02-17 08:33:46 -08:00
start.go Make sure container is destroyed on error 2016-02-22 15:34:41 -08:00
tty.go Add detach and pid-file to restore 2016-02-05 11:56:21 -08:00
utils.go Prevent a panic when container fails to start 2016-02-16 15:18:49 -08:00

README.md

[![Build Status](https://jenkins.dockerproject.org/buildStatus/icon?job=runc Master)](https://jenkins.dockerproject.org/job/runc Master)

runc

runc is a CLI tool for spawning and running containers according to the OCF specification.

State of the project

Currently runc is an implementation of the OCI specification. We are currently sprinting to have a v1 of the spec out. So the runc config format will be constantly changing until the spec is finalized. However, we encourage you to try out the tool and give feedback.

OCF

How does runc integrate with the Open Container Initiative Specification? runc depends on the types specified in the specs repository. Whenever the specification is updated and ready to be versioned runc will update its dependency on the specs repository and support the update spec.

Building:

At the time of writing, runc only builds on the Linux platform.

# create a 'github.com/opencontainers' in your GOPATH/src
cd github.com/opencontainers
git clone https://github.com/opencontainers/runc
cd runc
make
sudo make install

In order to enable seccomp support you will need to install libseccomp on your platform. If you do not with to build runc with seccomp support you can add BUILDTAGS="" when running make.

Build Tags

runc supports optional build tags for compiling in support for various features.

Build Tag Feature Dependency
seccomp Syscall filtering libseccomp
selinux selinux process and mount labeling
apparmor apparmor profile support libapparmor

Testing:

You can run tests for runC by using command:

# make test

Note that test cases are run in Docker container, so you need to install docker first. And test requires mounting cgroups inside container, it's done by docker now, so you need a docker version newer than 1.8.0-rc2.

You can also run specific test cases by:

# make test TESTFLAGS="-run=SomeTestFunction"

Using:

To run a container with the id "test", execute runc start with the containers id as arg one in the bundle's root directory:

runc start test
/ $ ps
PID   USER     COMMAND
1     daemon   sh
5     daemon   sh
/ $

OCI Container JSON Format:

OCI container JSON format is based on OCI specs. You can generate JSON files by using runc spec. It assumes that the file-system is found in a directory called rootfs and there is a user with uid and gid of 0 defined within that file-system.

Examples:

Using a Docker image (requires version 1.3 or later)

To test using Docker's busybox image follow these steps:

  • Install docker and download the busybox image: docker pull busybox
  • Create a container from that image and export its contents to a tar file: docker export $(docker create busybox) > busybox.tar
  • Untar the contents to create your filesystem directory:
mkdir rootfs
tar -C rootfs -xf busybox.tar
  • Create config.json by using runc spec.
  • Execute runc start and you should be placed into a shell where you can run ps:
$ runc start test
/ # ps
PID   USER     COMMAND
    1 root     sh
    9 root     ps

Using runc with systemd

To use runc with systemd, you can create a unit file /usr/lib/systemd/system/minecraft.service as below (edit your own Description or WorkingDirectory or service name as you need).

[Unit]
Description=Minecraft Build Server
Documentation=http://minecraft.net
After=network.target

[Service]
CPUQuota=200%
MemoryLimit=1536M
ExecStart=/usr/local/bin/runc start minecraft
Restart=on-failure
WorkingDirectory=/containers/minecraftbuild

[Install]
WantedBy=multi-user.target

Make sure you have the bundle's root directory and JSON configs in your WorkingDirectory, then use systemd commands to start the service:

systemctl daemon-reload
systemctl start minecraft.service

Note that if you use JSON configs by runc spec, you need to modify config.json and change process.terminal to false so runc won't create tty, because we can't set terminal from the stdin when using systemd service.