|
@@ -45,7 +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
|
|
|
+ flDriverOpts 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,8 +77,8 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
|
|
|
cmd.Var(&flDns, []string{"#dns", "-dns"}, "Set custom dns servers")
|
|
|
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")
|
|
|
+ cmd.Var(&flLxcOpts, []string{"#lxc-conf", "#-lxc-conf"}, "Add custom lxc options --lxc-conf=\"lxc.cgroup.cpuset.cpus = 0,1\"")
|
|
|
+ cmd.Var(&flDriverOpts, []string{"o", "-opt"}, "Add custom driver options")
|
|
|
|
|
|
if err := cmd.Parse(args); err != nil {
|
|
|
return nil, nil, cmd, err
|
|
@@ -208,7 +208,10 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
|
|
|
WorkingDir: *flWorkingDir,
|
|
|
}
|
|
|
|
|
|
- pluginOptions := parsePluginOpts(flPluginOpts)
|
|
|
+ pluginOptions, err := parseDriverOpts(flDriverOpts)
|
|
|
+ if err != nil {
|
|
|
+ return nil, nil, cmd, err
|
|
|
+ }
|
|
|
|
|
|
hostConfig := &HostConfig{
|
|
|
Binds: binds,
|
|
@@ -218,7 +221,7 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
|
|
|
PortBindings: portBindings,
|
|
|
Links: flLinks.GetAll(),
|
|
|
PublishAllPorts: *flPublishAll,
|
|
|
- PluginOptions: pluginOptions,
|
|
|
+ DriverOptions: pluginOptions,
|
|
|
}
|
|
|
|
|
|
if sysInfo != nil && flMemory > 0 && !sysInfo.SwapLimit {
|
|
@@ -253,15 +256,18 @@ 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 {
|
|
|
+func parseDriverOpts(opts opts.ListOpts) (map[string][]string, error) {
|
|
|
out := make(map[string][]string, len(opts.GetAll()))
|
|
|
for _, o := range opts.GetAll() {
|
|
|
parts := strings.SplitN(o, " ", 2)
|
|
|
+ if len(parts) < 2 {
|
|
|
+ return nil, fmt.Errorf("invalid opt format %s", o)
|
|
|
+ }
|
|
|
values, exists := out[parts[0]]
|
|
|
if !exists {
|
|
|
values = []string{}
|
|
|
}
|
|
|
out[parts[0]] = append(values, parts[1])
|
|
|
}
|
|
|
- return out
|
|
|
+ return out, nil
|
|
|
}
|