diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 30514da319e..10f81702875 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -48,7 +48,7 @@ }, { "ImportPath": "github.com/opencontainers/specs", - "Rev": "89fbfc172945b685f28205bdd1bef2b738bc0b62" + "Rev": "8fa5eb040abe89f09767c1b249b10757bb431cc2" }, { "ImportPath": "github.com/syndtr/gocapability/capability", diff --git a/Godeps/_workspace/src/github.com/opencontainers/specs/bundle.md b/Godeps/_workspace/src/github.com/opencontainers/specs/bundle.md index 897ad4db6ad..1948e4869b0 100644 --- a/Godeps/_workspace/src/github.com/opencontainers/specs/bundle.md +++ b/Godeps/_workspace/src/github.com/opencontainers/specs/bundle.md @@ -12,20 +12,19 @@ A standard container bundle is made of the following 3 parts: # Directory layout -A Standard Container bundle is a directory containing all the content needed to load and run a container. This includes its configuration file, content directories, and cryptographic signatures. The main property of this directory layout is that it can be moved as a unit to another machine and run the same container. +A Standard Container bundle is a directory containing all the content needed to load and run a container. This includes its configuration file (`config.json`) and content directories. The main property of this directory layout is that it can be moved as a unit to another machine and run the same container. -One or more *content directories* may be adjacent to the configuration file. This at least includes the root filesystem (referenced in the configuration by the *rootfs* field) and other related content (signatures, other configs, etc.). The interpretation of these resources is specified in the configuration. +The syntax and semantics for `config.json` are described in [this specification](config.md). + +One or more *content directories* may be adjacent to the configuration file. This must include at least the root filesystem (referenced in the configuration file by the *root* field) and may include other related content (signatures, other configs, etc.). The interpretation of these resources is specified in the configuration. The names of the directories may be arbitrary, but users should consider using conventional names as in the example below. ``` / ! -- config.json ! ---- rootfs1 +--- rootfs ! ---- rootfs2 +--- signatures ``` -The syntax and semantics for config.json are described in this specification. - -One or more content directories can be specified as root file systems for containers. They COULD be called rootfs..10^100 but SHALL be called whatever you want. diff --git a/Godeps/_workspace/src/github.com/opencontainers/specs/config.md b/Godeps/_workspace/src/github.com/opencontainers/specs/config.md index 9fc1b4302eb..4d9117c7c09 100644 --- a/Godeps/_workspace/src/github.com/opencontainers/specs/config.md +++ b/Godeps/_workspace/src/github.com/opencontainers/specs/config.md @@ -1,7 +1,7 @@ # Configuration file The container’s top-level directory MUST contain a configuration file called `config.json`. -For now the schema is defined in [spec.go](https://github.com/opencontainers/runc/blob/master/spec.go) and [spec_linux.go](https://github.com/opencontainers/runc/blob/master/spec_linux.go), this will be moved to a JSON schema overtime. +For now the canonical schema is defined in [spec.go](spec.go) and [spec_linux.go](spec_linux.go), but this will be moved to a formal JSON schema over time. The configuration file contains metadata necessary to implement standard operations against the container. This includes the process to run, environment variables to inject, sandboxing features to use, etc. diff --git a/Godeps/_workspace/src/github.com/opencontainers/specs/spec_linux.go b/Godeps/_workspace/src/github.com/opencontainers/specs/spec_linux.go index 207f5c8855a..c272f65019e 100644 --- a/Godeps/_workspace/src/github.com/opencontainers/specs/spec_linux.go +++ b/Godeps/_workspace/src/github.com/opencontainers/specs/spec_linux.go @@ -17,8 +17,8 @@ type Linux struct { GidMappings []IDMapping `json:"gidMappings"` // Rlimits specifies rlimit options to apply to the container's process. Rlimits []Rlimit `json:"rlimits"` - // SystemProperties are a set of key value pairs that are set for the container on start. - SystemProperties map[string]string `json:"systemProperties"` + // Sysctl are a set of key value pairs that are set for the container on start. + Sysctl map[string]string `json:"sysctl"` // Resources contain cgroup information for handling resource constraints // for the container. Resources Resources `json:"resources"` @@ -106,6 +106,8 @@ type Memory struct { Swap int64 `json:"swap"` // Kernel memory limit (in bytes) Kernel int64 `json:"kernel"` + // How aggressive the kernel will swap memory pages. Range from 0 to 100. Set -1 to use system default. + Swappiness int64 `json:"swappiness"` } type CPU struct { diff --git a/libcontainer/configs/config.go b/libcontainer/configs/config.go index 04ea91ffd09..83381c84c20 100644 --- a/libcontainer/configs/config.go +++ b/libcontainer/configs/config.go @@ -135,9 +135,9 @@ type Config struct { // so that these files prevent any writes. ReadonlyPaths []string `json:"readonly_paths"` - // SystemProperties is a map of properties and their values. It is the equivalent of using + // Sysctl is a map of properties and their values. It is the equivalent of using // sysctl -w my.property.name value in Linux. - SystemProperties map[string]string `json:"system_properties"` + Sysctl map[string]string `json:"sysctl"` // Seccomp allows actions to be taken whenever a syscall is made within the container. // By default, all syscalls are allowed with actions to allow, trap, kill, or return an errno diff --git a/libcontainer/integration/exec_test.go b/libcontainer/integration/exec_test.go index c14c659f15a..8811863866c 100644 --- a/libcontainer/integration/exec_test.go +++ b/libcontainer/integration/exec_test.go @@ -753,7 +753,7 @@ func TestMountCmds(t *testing.T) { } } -func TestSystemProperties(t *testing.T) { +func TestSysctl(t *testing.T) { if testing.Short() { return } @@ -766,7 +766,7 @@ func TestSystemProperties(t *testing.T) { defer remove(rootfs) config := newTemplateConfig(rootfs) - config.SystemProperties = map[string]string{ + config.Sysctl = map[string]string{ "kernel.shmmni": "8192", } diff --git a/libcontainer/standard_init_linux.go b/libcontainer/standard_init_linux.go index 74a32293424..b399aa5d1f9 100644 --- a/libcontainer/standard_init_linux.go +++ b/libcontainer/standard_init_linux.go @@ -65,7 +65,7 @@ func (l *linuxStandardInit) Init() error { return err } - for key, value := range l.config.Config.SystemProperties { + for key, value := range l.config.Config.Sysctl { if err := writeSystemProperty(key, value); err != nil { return err } diff --git a/spec.go b/spec.go index 4a31f02d1c9..ec36cfbcf33 100644 --- a/spec.go +++ b/spec.go @@ -211,6 +211,7 @@ func createLibcontainerConfig(spec *specs.LinuxSpec) (*configs.Config, error) { "/proc/sys", "/proc/sysrq-trigger", "/proc/irq", "/proc/bus", } } + config.Sysctl = spec.Linux.Sysctl return config, nil }