Go to file
Zhao Lei a6a0cdf53d manual: Use SYNOPSIS instead of USAGE in man/runc-checkpoint.8.md
Reason1:
 other runc manual are using word of "SYNOPSIS"
 # grep USAGE man/*
 # man/runc-checkpoint.8.md:#USAGE
 #
 # grep SYNOPSIS man/*
 man/runc-checkpoint.8.md:# SYNOPSIS
 man/runc-delete.8.md:# SYNOPSIS
 man/runc-events.8.md:# SYNOPSIS
 man/runc-exec.8.md:# SYNOPSIS
 man/runc-kill.8.md:# SYNOPSIS
 man/runc-list.8.md:# SYNOPSIS
 man/runc-pause.8.md:# SYNOPSIS
 man/runc-restore.8.md:# SYNOPSIS
 man/runc-resume.8.md:# SYNOPSIS
 man/runc-spec.8.md:# SYNOPSIS
 man/runc-start.8.md:# SYNOPSIS
 man/runc-state.8.md:# SYNOPSIS
 man/runc-update.8.md:# SYNOPSIS
 man/runc.8.md:# SYNOPSIS
 #

Reason2:
 Most linux commands are using word of "SYNOPSIS"
 # man ls
 # man find
 # ...

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
2016-05-25 10:48:11 +08:00
Godeps Update cli package 2016-05-10 13:58:09 +08:00
libcontainer *: correctly chown() consoles 2016-05-22 22:37:13 +10:00
man manual: Use SYNOPSIS instead of USAGE in man/runc-checkpoint.8.md 2016-05-25 10:48:11 +08:00
script Merge pull request #826 from hqhq/hq_add_check_config 2016-05-18 16:42:30 -07:00
tests/integration Merge pull request #828 from hqhq/hq_fix_update_kmem 2016-05-24 09:58:09 -07:00
.gitignore Update .gitignore for generate man pages 2016-03-04 11:14:12 -08:00
CONTRIBUTING.md Move libcontainer documenation to root of repo 2015-06-26 11:50:46 -07:00
Dockerfile Add a Dockerfile and a dbuild target. This allows you to build runC via Docker without having Golang installed on the host 2015-12-18 11:37:12 +00:00
LICENSE Initial commit of runc binary 2015-06-21 19:34:13 -07:00
MAINTAINERS MAINTAINERS: add Aleksa Sarai to maintainers 2016-03-15 15:09:53 +11:00
MAINTAINERS_GUIDE.md Update maintainers guide 2015-07-21 10:59:56 -07:00
Makefile *: enable full test suite on make test 2016-05-03 17:15:49 +10: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 Updating README for runc path 2016-04-23 22:00:08 +05:30
checkpoint.go Update cli package 2016-05-10 13:58:09 +08:00
delete.go Update cli package 2016-05-10 13:58:09 +08:00
events.go Update cli package 2016-05-10 13:58:09 +08:00
exec.go Update cli package 2016-05-10 13:58:09 +08:00
kill.go Update cli package 2016-05-10 13:58:09 +08:00
list.go Update cli package 2016-05-10 13:58:09 +08:00
main.go Add new `update` command to runc. 2016-05-06 08:05:15 -07:00
main_solaris.go Get runc to build clean on Solaris 2016-04-12 16:13:08 -07:00
main_unix.go Windows: Remove nsenter dependency 2015-06-28 17:04:16 -07:00
main_unsupported.go Get runc to build clean on Solaris 2016-04-12 16:13:08 -07:00
pause.go Update cli package 2016-05-10 13:58:09 +08:00
ps.go Update cli package 2016-05-10 13:58:09 +08:00
restore.go *: correctly chown() consoles 2016-05-22 22:37:13 +10:00
rlimit_linux.go Fixing rlimit sigpending value 2016-04-03 22:25:41 +05:30
signals.go Destroy container along with processes before stdio 2016-03-15 13:17:11 -07:00
spec.go Merge pull request #810 from hqhq/hq_update_cli 2016-05-20 20:46:59 -07:00
start.go Update cli package 2016-05-10 13:58:09 +08:00
state.go Update cli package 2016-05-10 13:58:09 +08:00
tty.go *: correctly chown() consoles 2016-05-22 22:37:13 +10:00
update.go Merge pull request #810 from hqhq/hq_update_cli 2016-05-20 20:46:59 -07:00
utils.go Get runc to build clean on Solaris 2016-04-12 16:13:08 -07:00
utils_linux.go *: correctly chown() consoles 2016-05-22 22:37:13 +10: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 OCI 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 want 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 in a directory:
mkdir rootfs
docker export $(docker create busybox) | tar -C rootfs -xvf -
  • 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/sbin/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.