docker/cli ยท error

failed to update service %s: %w

Error message

failed to update service %s: %w

What it means

Error "failed to update service %s: %w" thrown in docker/cli.

Source

Thrown at cli/command/stack/deploy_composefile.go:274

			default:
				if image == svc.Spec.Labels[convert.LabelImage] {
					// image has not changed; update the serviceSpec with the
					// existing information that was set by QueryRegistry on the
					// previous deploy. Otherwise this will trigger an incorrect
					// service update.
					serviceSpec.TaskTemplate.ContainerSpec.Image = svc.Spec.TaskTemplate.ContainerSpec.Image
				}
			}

			// Stack deploy does not have a `--force` option. Preserve existing
			// ForceUpdate value so that tasks are not re-deployed if not updated.
			// TODO move this to API client?
			serviceSpec.TaskTemplate.ForceUpdate = svc.Spec.TaskTemplate.ForceUpdate

			updateOpts.Spec = serviceSpec
			response, err := apiClient.ServiceUpdate(ctx, svc.ID, updateOpts)
			if err != nil {
				return nil, fmt.Errorf("failed to update service %s: %w", name, err)
			}

			for _, warning := range response.Warnings {
				_, _ = fmt.Fprintln(dockerCLI.Err(), warning)
			}

			serviceIDs = append(serviceIDs, svc.ID)
		} else {
			_, _ = fmt.Fprintln(out, "Creating service", name)

			// query registry if flag disabling it was not set
			queryRegistry := resolveImage == resolveImageAlways || resolveImage == resolveImageChanged

			response, err := apiClient.ServiceCreate(ctx, client.ServiceCreateOptions{
				Spec:                serviceSpec,
				EncodedRegistryAuth: encodedAuth,
				QueryRegistry:       queryRegistry,
			})

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/command/stack/deploy_composefile.go:274 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/e828697d8e5e6c21.json. Report an issue: GitHub.