(ctx context.Context, dockerCLI command.Cli, opts *restartOptions)
| 57 | } |
| 58 | |
| 59 | func 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 | } |
no test coverage detected
searching dependent graphs…