docker/cli · error

update and rollback configuration is not supported for jobs

Error message

update and rollback configuration is not supported for jobs

What it means

In `serviceOptions.ToService()` at opts.go:729-737, after computing the service mode and the update/rollback configs, the code checks whether the service is a job (`ReplicatedJob != nil || GlobalJob != nil`) AND whether either `updateConfig` or `rollbackConfig` is non-nil. Jobs are one-shot batch operations that do not support rolling updates or rollbacks — they simply run to completion. This error fires when update/rollback flags (`--update-*`, `--rollback-*`) are combined with `--mode replicated-job` or `--mode global-job`.

Solutions

  1. Remove all `--update-*` and `--rollback-*` flags when using `--mode replicated-job` or `--mode global-job`
  2. Switch to `--mode replicated` (or `global`) if rolling update/rollback behavior is needed

Example fix

# before
docker service create --mode replicated-job --replicas 10 \
  --update-parallelism 2 --update-delay 10s --image myjob web
# error: update and rollback configuration is not supported for jobs

# after (job without update config)
docker service create --mode replicated-job --replicas 10 --image myjob web

# after (replicated service with update config)
docker service create --mode replicated --replicas 10 \
  --update-parallelism 2 --update-delay 10s --image nginx web
Defensive patterns

Strategy: validation

Validate before calling

// Validate that update/rollback config is not used with job modes
func validateUpdateConfigWithMode(mode swarm.ServiceMode, updateConfig, rollbackConfig *swarm.UpdateConfig) error {
    if (mode.ReplicatedJob != nil || mode.GlobalJob != nil) && (updateConfig != nil || rollbackConfig != nil) {
        return errors.New("update and rollback configuration is not supported for jobs")
    }
    return nil
}

Prevention

When it happens

Trigger: Running `docker service create --mode replicated-job --replicas 10 --update-parallelism 2 --image myjob web`. The `updateConfig`/`rollbackConfig` values are non-nil only when at least one update/rollback flag was changed (checked via `anyChanged` at lines 175 and 204).

Common situations: A developer converts a long-running replicated service to a job and leaves the update/rollback configuration flags in place, or a deployment template applies update config to all services indiscriminately.

Related errors


AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07). Data as JSON: /api/errors/7eeea0bf992a5aa1. Report an issue: GitHub.

Appendix: source

Thrown at cli/command/service/opts.go:736

	healthConfig, err := options.healthcheck.toHealthConfig()
	if err != nil {
		return service, err
	}

	serviceMode, err := options.ToServiceMode()
	if err != nil {
		return service, err
	}

	updateConfig := options.update.updateConfig(flags)
	rollbackConfig := options.rollback.rollbackConfig(flags)

	// update and rollback configuration is not supported for jobs. If these
	// flags are not set, then the values will be nil. If they are non-nil,
	// then return an error.
	if (serviceMode.ReplicatedJob != nil || serviceMode.GlobalJob != nil) && (updateConfig != nil || rollbackConfig != nil) {
		return service, errors.New("update and rollback configuration is not supported for jobs")
	}

	networks := convertNetworks(options.networks)
	for i, net := range networks {
		nwID, err := resolveNetworkID(ctx, apiClient, net.Target)
		if err != nil {
			return service, err
		}
		networks[i].Target = nwID
	}
	sort.Slice(networks, func(i, j int) bool {
		return networks[i].Target < networks[j].Target
	})

	resources, err := options.resources.ToResourceRequirements(flags)
	if err != nil {
		return service, err
	}

View on GitHub (pinned to 4f84911bfe)