From e6ef913bb19ce8d35f5d2abd839cfbff57100ea4 Mon Sep 17 00:00:00 2001 From: Oscar Zhou <100548325+oscarzhou-portainer@users.noreply.github.com> Date: Wed, 8 Nov 2023 11:43:42 +1300 Subject: [PATCH] fix(docker/swarm): suppress no such container logs (#10604) --- api/docker/snapshot.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/docker/snapshot.go b/api/docker/snapshot.go index 48cbb1b49..66cfcb3cc 100644 --- a/api/docker/snapshot.go +++ b/api/docker/snapshot.go @@ -174,7 +174,12 @@ func snapshotContainers(snapshot *portainer.DockerSnapshot, cli *client.Client) if !snapshot.Swarm { return err } else { - log.Info().Str("container", container.ID).Err(err).Msg("unable to inspect container in other Swarm nodes") + if !strings.Contains(err.Error(), "No such container") { + return err + } + // It is common to have containers running on different Swarm nodes, + // so we just log the error in the debug level + log.Debug().Str("container", container.ID).Err(err).Msg("unable to inspect container in other Swarm nodes") } } else { var gpuOptions *_container.DeviceRequest = nil