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

Function runRestart

cli/command/container/restart.go:59–80  ·  view source on GitHub ↗
(ctx context.Context, dockerCLI command.Cli, opts *restartOptions)

Source from the content-addressed store, hash-verified

57}
58
59func runRestart(ctx context.Context, dockerCLI command.Cli, opts *restartOptions) error {
60 var timeout *int
61 if opts.timeoutChanged {
62 timeout = &opts.timeout
63 }
64
65 apiClient := dockerCLI.Client()
66 var errs []error
67 // TODO(thaJeztah): consider using parallelOperation for restart, similar to "stop" and "remove"
68 for _, name := range opts.containers {
69 _, err := apiClient.ContainerRestart(ctx, name, client.ContainerRestartOptions{
70 Signal: opts.signal,
71 Timeout: timeout,
72 })
73 if err != nil {
74 errs = append(errs, err)
75 continue
76 }
77 _, _ = fmt.Fprintln(dockerCLI.Out(), name)
78 }
79 return errors.Join(errs...)
80}

Callers 1

newRestartCommandFunction · 0.85

Calls 3

ContainerRestartMethod · 0.80
ClientMethod · 0.65
OutMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…