(ctx context.Context, dockerCLI command.Cli, flags *pflag.FlagSet, ropts *runOptions, copts *containerOptions)
| 85 | } |
| 86 | |
| 87 | func runRun(ctx context.Context, dockerCLI command.Cli, flags *pflag.FlagSet, ropts *runOptions, copts *containerOptions) error { |
| 88 | if err := validatePullOpt(ropts.pull); err != nil { |
| 89 | return cli.StatusError{ |
| 90 | Status: withHelp(err, "run").Error(), |
| 91 | StatusCode: 125, |
| 92 | } |
| 93 | } |
| 94 | proxyConfig := dockerCLI.ConfigFile().ParseProxyConfig(dockerCLI.Client().DaemonHost(), opts.ConvertKVStringsToMapWithNil(copts.env.GetSlice())) |
| 95 | newEnv := []string{} |
| 96 | for k, v := range proxyConfig { |
| 97 | if v == nil { |
| 98 | newEnv = append(newEnv, k) |
| 99 | } else { |
| 100 | newEnv = append(newEnv, k+"="+*v) |
| 101 | } |
| 102 | } |
| 103 | copts.env = *opts.NewListOptsRef(&newEnv, nil) |
| 104 | serverInfo, err := dockerCLI.Client().Ping(ctx, client.PingOptions{}) |
| 105 | if err != nil { |
| 106 | return err |
| 107 | } |
| 108 | |
| 109 | containerCfg, err := parse(flags, copts, serverInfo.OSType) |
| 110 | // just in case the parse does not exit |
| 111 | if err != nil { |
| 112 | return cli.StatusError{ |
| 113 | Status: withHelp(err, "run").Error(), |
| 114 | StatusCode: 125, |
| 115 | } |
| 116 | } |
| 117 | return runContainer(ctx, dockerCLI, ropts, copts, containerCfg) |
| 118 | } |
| 119 | |
| 120 | //nolint:gocyclo |
| 121 | func runContainer(ctx context.Context, dockerCli command.Cli, runOpts *runOptions, copts *containerOptions, containerCfg *containerConfig) error { |
searching dependent graphs…