|
@@ -45,6 +45,7 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
|
|
|
flDnsSearch = opts.NewListOpts(opts.ValidateDomain)
|
|
|
flVolumesFrom opts.ListOpts
|
|
|
flLxcOpts opts.ListOpts
|
|
|
+ flPluginOpts opts.ListOpts
|
|
|
|
|
|
flAutoRemove = cmd.Bool([]string{"#rm", "-rm"}, false, "Automatically remove the container when it exits (incompatible with -d)")
|
|
|
flDetach = cmd.Bool([]string{"d", "-detach"}, false, "Detached mode: Run container in the background, print new container id")
|
|
@@ -77,6 +78,7 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
|
|
|
cmd.Var(&flDnsSearch, []string{"-dns-search"}, "Set custom dns search domains")
|
|
|
cmd.Var(&flVolumesFrom, []string{"#volumes-from", "-volumes-from"}, "Mount volumes from the specified container(s)")
|
|
|
cmd.Var(&flLxcOpts, []string{"#lxc-conf", "-lxc-conf"}, "Add custom lxc options --lxc-conf=\"lxc.cgroup.cpuset.cpus = 0,1\"")
|
|
|
+ cmd.Var(&flPluginOpts, []string{"-plugin"}, "Add custom plugin options")
|
|
|
|
|
|
if err := cmd.Parse(args); err != nil {
|
|
|
return nil, nil, cmd, err
|
|
@@ -206,6 +208,8 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
|
|
|
WorkingDir: *flWorkingDir,
|
|
|
}
|
|
|
|
|
|
+ pluginOptions := parsePluginOpts(flPluginOpts)
|
|
|
+
|
|
|
hostConfig := &HostConfig{
|
|
|
Binds: binds,
|
|
|
ContainerIDFile: *flContainerIDFile,
|
|
@@ -214,6 +218,7 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
|
|
|
PortBindings: portBindings,
|
|
|
Links: flLinks.GetAll(),
|
|
|
PublishAllPorts: *flPublishAll,
|
|
|
+ PluginOptions: pluginOptions,
|
|
|
}
|
|
|
|
|
|
if sysInfo != nil && flMemory > 0 && !sysInfo.SwapLimit {
|
|
@@ -247,3 +252,16 @@ func parseLxcOpt(opt string) (string, string, error) {
|
|
|
}
|
|
|
return strings.TrimSpace(parts[0]), strings.TrimSpace(parts[1]), nil
|
|
|
}
|
|
|
+
|
|
|
+func parsePluginOpts(opts opts.ListOpts) map[string][]string {
|
|
|
+ out := make(map[string][]string, len(opts.GetAll()))
|
|
|
+ for _, o := range opts.GetAll() {
|
|
|
+ parts := strings.SplitN(o, " ", 2)
|
|
|
+ values, exists := out[parts[0]]
|
|
|
+ if !exists {
|
|
|
+ values = []string{}
|
|
|
+ }
|
|
|
+ out[parts[0]] = append(values, parts[1])
|
|
|
+ }
|
|
|
+ return out
|
|
|
+}
|