mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
f637539def9b0c1e9226387c940c77f7777d9cbe
This moves much of the documentation on contributing and maintainer the codebase from the libcontainer sub directory to the root of the repo. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
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 OCF specification. We are currently sprinting
to have a v1 of the spec out within a quick timeframe of a few weeks, ~July 2015,
so the runc config format will be constantly changing until
the spec is finalialized. However, we encourage you to try out the tool and give feedback.
Building:
go get -d github.com/opencontainers/runc
cd $GOPATH/src/github.com/opencontainers/runc/
make
sudo make install
Using:
To run a container that you received just execute runc run with the JSON format at the argument or have a
container.json file in the current working directory.
runc
/ $ ps
PID USER COMMAND
1 daemon sh
5 daemon sh
/ $
OCF Container JSON Format:
{
"version": "0.1",
"os": "linux",
"arch": "amd64",
"processes": [
{
"tty": true,
"user": "daemon",
"args": [
"sh"
],
"env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"TERM=xterm"
],
"cwd": ""
}
],
"root": {
"path": "rootfs",
"readonly": true
},
"cpus": 1.1,
"memory": 1024,
"hostname": "shell",
"namespaces": [
{
"type": "process"
},
{
"type": "network"
},
{
"type": "mount"
},
{
"type": "ipc"
},
{
"type": "uts"
}
],
"capabilities": [
"AUDIT_WRITE",
"KILL",
"NET_BIND_SERVICE"
],
"devices": [
"null",
"random",
"full",
"tty",
"zero",
"urandom"
],
"mounts": [
{
"type": "proc",
"source": "proc",
"destination": "/proc",
"options": ""
},
{
"type": "tmpfs",
"source": "tmpfs",
"destination": "/dev",
"options": "nosuid,strictatime,mode=755,size=65536k"
},
{
"type": "devpts",
"source": "devpts",
"destination": "/dev/pts",
"options": "nosuid,noexec,newinstance,ptmxmode=0666,mode=0620,gid=5"
},
{
"type": "tmpfs",
"source": "shm",
"destination": "/dev/shm",
"options": "nosuid,noexec,nodev,mode=1777,size=65536k"
},
{
"type": "mqueue",
"source": "mqueue",
"destination": "/dev/mqueue",
"options": "nosuid,noexec,nodev"
},
{
"type": "sysfs",
"source": "sysfs",
"destination": "/sys",
"options": "nosuid,noexec,nodev"
}
]
}
Examples:
Using runc with systemd
[Unit]
Description=Minecraft Build Server
Documentation=http://minecraft.net
After=network.target
[Service]
CPUQuota=200%
MemoryLimit=1536M
ExecStart=/usr/local/bin/runc
Restart=on-failure
WorkingDirectory=/containers/minecraftbuild
[Install]
WantedBy=multi-user.target
Description
Languages
Go
68.2%
Shell
27.5%
C
3.5%
Makefile
0.6%
Dockerfile
0.2%