diff --git a/api/http/handler/endpoints/endpoint_force_update_service.go b/api/http/handler/endpoints/endpoint_force_update_service.go index 730c6e79b..9cd0456ed 100644 --- a/api/http/handler/endpoints/endpoint_force_update_service.go +++ b/api/http/handler/endpoints/endpoint_force_update_service.go @@ -11,6 +11,7 @@ import ( httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" + "github.com/rs/zerolog/log" dockertypes "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" @@ -94,10 +95,14 @@ func (handler *Handler) endpointForceUpdateService(w http.ResponseWriter, r *htt go func() { images.EvictImageStatus(payload.ServiceID) images.EvictImageStatus(service.Spec.Labels[consts.SwarmStackNameLabel]) - containers, _ := dockerClient.ContainerList(context.TODO(), container.ListOptions{ + // ignore errors from this cleanup function, log them instead + containers, err := dockerClient.ContainerList(context.TODO(), container.ListOptions{ All: true, Filters: filters.NewArgs(filters.Arg("label", consts.SwarmServiceIdLabel+"="+payload.ServiceID)), }) + if err != nil { + log.Warn().Err(err).Str("Environment", endpoint.Name).Msg("Error listing containers") + } for _, container := range containers { images.EvictImageStatus(container.ID) diff --git a/api/http/handler/stacks/create_swarm_stack.go b/api/http/handler/stacks/create_swarm_stack.go index 60a26ed81..b87339c9d 100644 --- a/api/http/handler/stacks/create_swarm_stack.go +++ b/api/http/handler/stacks/create_swarm_stack.go @@ -77,7 +77,6 @@ func (handler *Handler) createSwarmStackFromFileContent(w http.ResponseWriter, r payload.Name = handler.SwarmStackManager.NormalizeStackName(payload.Name) isUnique, err := handler.checkUniqueStackNameInDocker(endpoint, payload.Name, 0, true) - if err != nil { return httperror.InternalServerError("Unable to check for name collision", err) }