From 7bf06d53dd45bdfa906450d52cff55f077bef83b Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Fri, 18 Dec 2015 15:47:21 -0500 Subject: [PATCH] source and schema: differentiate with examples The standard is on the JSON schema (not yet IETF spec JSON-schema), such that it is not implemenations specific. Thus far, the reference has been in how golang source renders the JSON documents. Having the JSON source and the markdown documents in sync has been an ongoing step to keep in sync. Separating these two allows the golang source to continue being _a_ reference, but the JSON schema in the documentation to be _the_ reference. As validation tooling is refined, then it will facilitate ensuring the available golang source conforms to the reference JSON. Signed-off-by: Vincent Batts --- config.md | 156 ++++++++++++++++++++ config.go => specs-go/config.go | 0 config_linux.go => specs-go/config_linux.go | 0 state.go => specs-go/state.go | 0 version.go => specs-go/version.go | 0 5 files changed, 156 insertions(+) rename config.go => specs-go/config.go (100%) rename config_linux.go => specs-go/config_linux.go (100%) rename state.go => specs-go/state.go (100%) rename version.go => specs-go/version.go (100%) diff --git a/config.md b/config.md index 50dff8ef0..a31f86deb 100644 --- a/config.md +++ b/config.md @@ -244,4 +244,160 @@ Annotations are key-value maps. } ``` +## Configuration Schema Example + +Here is a full example `config.json` for reference. + +```json +{ + "ociVersion": "0.3.0", + "platform": { + "os": "linux", + "arch": "amd64" + }, + "process": { + "terminal": true, + "user": { + "uid": 1, + "gid": 1, + "additionalGids": [5, 6] + }, + "args": [ + "sh" + ], + "env": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + "TERM=xterm" + ], + "cwd": "/", + "capabilities": [ + "CAP_AUDIT_WRITE", + "CAP_KILL", + "CAP_NET_BIND_SERVICE" + ], + "apparmorProfile": "", + "selinuxLabel": "" + }, + "root": { + "path": "rootfs", + "readonly": true + }, + "hostname": "slartibartfast", + "mounts": [ + { + "destination": "/proc", + "type": "proc", + "source": "proc" + }, + { + "destination": "/dev", + "type": "tmpfs", + "source": "tmpfs", + "options": [ + "nosuid", + "strictatime", + "mode=755", + "size=65536k" + ] + }, + { + "destination": "/dev/pts", + "type": "devpts", + "source": "devpts", + "options": [ + "nosuid", + "noexec", + "newinstance", + "ptmxmode=0666", + "mode=0620", + "gid=5" + ] + }, + { + "destination": "/dev/shm", + "type": "tmpfs", + "source": "shm", + "options": [ + "nosuid", + "noexec", + "nodev", + "mode=1777", + "size=65536k" + ] + }, + { + "destination": "/dev/mqueue", + "type": "mqueue", + "source": "mqueue", + "options": [ + "nosuid", + "noexec", + "nodev" + ] + }, + { + "destination": "/sys", + "type": "sysfs", + "source": "sysfs", + "options": [ + "nosuid", + "noexec", + "nodev" + ] + }, + { + "destination": "/sys/fs/cgroup", + "type": "cgroup", + "source": "cgroup", + "options": [ + "nosuid", + "noexec", + "nodev", + "relatime", + "ro" + ] + } + ], + "hooks": { + "prestart": [ + { + "path": "/", + "args": ["/usr/bin/uptime"], + "env": [] + } + ] + }, + "linux": { + "rlimits": [ + { + "type": "RLIMIT_NOFILE", + "hard": 1024, + "soft": 1024 + } + ], + "resources": { + "devices": [ + { + "allow": false, + "access": "rwm" + } + ] + }, + "namespaces": [ + { "type": "pid" }, + { "type": "network" }, + { "type": "ipc" }, + { "type": "uts" }, + { "type": "mount" } + ], + "devices": null, + "seccomp": { + "defaultAction": "", + "architectures": null + } + } +} +``` + + [uts-namespace]: http://man7.org/linux/man-pages/man7/namespaces.7.html diff --git a/config.go b/specs-go/config.go similarity index 100% rename from config.go rename to specs-go/config.go diff --git a/config_linux.go b/specs-go/config_linux.go similarity index 100% rename from config_linux.go rename to specs-go/config_linux.go diff --git a/state.go b/specs-go/state.go similarity index 100% rename from state.go rename to specs-go/state.go diff --git a/version.go b/specs-go/version.go similarity index 100% rename from version.go rename to specs-go/version.go