Skip to content

Commit d2bb3ab

Browse files
committed
Support parallel kill
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
1 parent 6997182 commit d2bb3ab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cli/command/container/kill.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ func NewKillCommand(dockerCli *command.DockerCli) *cobra.Command {
3939
func runKill(dockerCli *command.DockerCli, opts *killOptions) error {
4040
var errs []string
4141
ctx := context.Background()
42+
errChan := parallelOperation(ctx, opts.containers, func(ctx context.Context, container string) error {
43+
return dockerCli.Client().ContainerKill(ctx, container, opts.signal)
44+
})
4245
for _, name := range opts.containers {
43-
if err := dockerCli.Client().ContainerKill(ctx, name, opts.signal); err != nil {
46+
if err := <-errChan; err != nil {
4447
errs = append(errs, err.Error())
4548
} else {
4649
fmt.Fprintf(dockerCli.Out(), "%s\n", name)

0 commit comments

Comments
 (0)