docker/cli · error

other flags may not be combined with --rollback

Error message

other flags may not be combined with --rollback

What it means

Emitted by `docker service update --rollback`. At update.go:168-181 the CLI walks every changed flag; only --rollback, --detach and --quiet are allowed alongside a rollback. Rollback restores the service's PreviousSpec verbatim, so combining it with spec-mutating flags (--image, --env-add, ...) would be contradictory — the CLI rejects it rather than silently ignoring the extra flags.

Source

Thrown at cli/command/service/update.go:180

	rollback, err := flags.GetBool(flagRollback)
	if err != nil {
		return err
	}

	if rollback {
		// Rollback can't be combined with other flags.
		otherFlagsPassed := false
		flags.VisitAll(func(f *pflag.Flag) {
			if f.Name == flagRollback || f.Name == flagDetach || f.Name == flagQuiet {
				return
			}
			if flags.Changed(f.Name) {
				otherFlagsPassed = true
			}
		})
		if otherFlagsPassed {
			return errors.New("other flags may not be combined with --rollback")
		}
	}

	updateOpts := client.ServiceUpdateOptions{}
	rollbackAction := "none"
	if rollback {
		rollbackAction = "previous"
	}

	spec := &res.Service.Spec
	err = updateService(ctx, apiClient, flags, spec)
	if err != nil {
		return err
	}

	if flags.Changed("image") {
		updateOpts.QueryRegistry = !options.noResolveImage
	}

View on GitHub (pinned to e9452d6e78)

Solutions

  1. Run the rollback alone: `docker service update --rollback <svc>` (optionally with --detach/--quiet)
  2. If you want a specific older configuration rather than the previous spec, drop --rollback and specify the desired flags explicitly (e.g. --image foo:v1)
  3. Split into two commands: rollback first, then a separate `docker service update` for further changes

Example fix

# before
docker service update --rollback --image myapp:1.0 web

# after
docker service update --rollback web
# or, to pin a specific version:
docker service update --image myapp:1.0 web

When it happens

Trigger: `docker service update --rollback --image foo:v1 mysvc` or any invocation where flags.Changed() is true for a flag other than rollback/detach/quiet while --rollback is set.

Common situations: Trying to 'roll back and also fix' in one command; scripts that always append common flags (e.g. --with-registry-auth) to every update invocation including rollbacks; misunderstanding rollback as 'update to a specified older version'.

Related errors


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