From ee4c249cc2a76bd595f6246c67ccb932a284afa7 Mon Sep 17 00:00:00 2001 From: AmirHossein HajiMohammadi Date: Thu, 16 Jul 2026 23:06:54 +0330 Subject: [PATCH] container rm: suppress forced not found errors Signed-off-by: AmirHossein HajiMohammadi --- cli/command/container/rm.go | 1 - cli/command/container/rm_test.go | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/command/container/rm.go b/cli/command/container/rm.go index c38256a468b4..eaa23dec04bc 100644 --- a/cli/command/container/rm.go +++ b/cli/command/container/rm.go @@ -88,7 +88,6 @@ func runRm(ctx context.Context, dockerCLI command.Cli, opts *rmOptions) error { for _, name := range opts.containers { if err := <-errChan; err != nil { if opts.force && errdefs.IsNotFound(err) { - _, _ = fmt.Fprintln(dockerCLI.Err(), err) continue } errs = append(errs, err) diff --git a/cli/command/container/rm_test.go b/cli/command/container/rm_test.go index 86f6c4e0a2e9..4ab14407bb35 100644 --- a/cli/command/container/rm_test.go +++ b/cli/command/container/rm_test.go @@ -52,6 +52,7 @@ func TestRemoveForce(t *testing.T) { } else { assert.NilError(t, err) } + assert.Equal(t, cli.ErrBuffer().String(), "") sort.Strings(removed) assert.DeepEqual(t, removed, []string{"mycontainer", "nosuchcontainer"}) })