MCPcopy Index your code
hub / github.com/docker/cli / runRun

Function runRun

cli/command/container/run.go:87–118  ·  view source on GitHub ↗
(ctx context.Context, dockerCLI command.Cli, flags *pflag.FlagSet, ropts *runOptions, copts *containerOptions)

Source from the content-addressed store, hash-verified

85}
86
87func 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
121func runContainer(ctx context.Context, dockerCli command.Cli, runOpts *runOptions, copts *containerOptions, containerCfg *containerConfig) error {

Callers 2

newRunCommandFunction · 0.85

Calls 10

validatePullOptFunction · 0.85
withHelpFunction · 0.85
parseFunction · 0.85
runContainerFunction · 0.85
ParseProxyConfigMethod · 0.80
GetSliceMethod · 0.80
ConfigFileMethod · 0.65
ClientMethod · 0.65
ErrorMethod · 0.45
PingMethod · 0.45

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…