Merge pull request #562 from mrunalp/sys_prop_flag

Add a flag for specifying system properties.
This commit is contained in:
Michael Crosby 2015-05-18 11:08:32 -07:00
commit ef5240072a
1 changed files with 9 additions and 0 deletions

View File

@ -44,6 +44,7 @@ var createFlags = []cli.Flag{
cli.StringFlag{Name: "veth-gateway", Usage: "veth gateway address"},
cli.IntFlag{Name: "veth-mtu", Usage: "veth mtu"},
cli.BoolFlag{Name: "cgroup", Usage: "mount the cgroup data for the container"},
cli.StringSliceFlag{Name: "sysctl", Value: &cli.StringSlice{}, Usage: "set system properties in the container"},
}
var configCommand = cli.Command{
@ -111,6 +112,14 @@ func modify(config *configs.Config, context *cli.Context) {
node.Gid = uint32(userns_uid)
}
}
config.SystemProperties = make(map[string]string)
for _, sysProp := range context.StringSlice("sysctl") {
parts := strings.SplitN(sysProp, "=", 2)
if len(parts) != 2 {
logrus.Fatalf("invalid system property %s", sysProp)
}
config.SystemProperties[parts[0]] = parts[1]
}
for _, rawBind := range context.StringSlice("bind") {
mount := &configs.Mount{
Device: "bind",