{"record":{"id":"7eeea0bf992a5aa1","repo":"docker/cli","slug":"update-and-rollback-configuration-is-not-supported","errorCode":null,"errorMessage":"update and rollback configuration is not supported for jobs","messagePattern":"update and rollback configuration is not supported for jobs","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/service/opts.go","lineNumber":736,"sourceCode":"\n\thealthConfig, err := options.healthcheck.toHealthConfig()\n\tif err != nil {\n\t\treturn service, err\n\t}\n\n\tserviceMode, err := options.ToServiceMode()\n\tif err != nil {\n\t\treturn service, err\n\t}\n\n\tupdateConfig := options.update.updateConfig(flags)\n\trollbackConfig := options.rollback.rollbackConfig(flags)\n\n\t// update and rollback configuration is not supported for jobs. If these\n\t// flags are not set, then the values will be nil. If they are non-nil,\n\t// then return an error.\n\tif (serviceMode.ReplicatedJob != nil || serviceMode.GlobalJob != nil) && (updateConfig != nil || rollbackConfig != nil) {\n\t\treturn service, errors.New(\"update and rollback configuration is not supported for jobs\")\n\t}\n\n\tnetworks := convertNetworks(options.networks)\n\tfor i, net := range networks {\n\t\tnwID, err := resolveNetworkID(ctx, apiClient, net.Target)\n\t\tif err != nil {\n\t\t\treturn service, err\n\t\t}\n\t\tnetworks[i].Target = nwID\n\t}\n\tsort.Slice(networks, func(i, j int) bool {\n\t\treturn networks[i].Target < networks[j].Target\n\t})\n\n\tresources, err := options.resources.ToResourceRequirements(flags)\n\tif err != nil {\n\t\treturn service, err\n\t}","sourceCodeStart":718,"sourceCodeEnd":754,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/service/opts.go#L718-L754","documentation":"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`.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Remove all `--update-*` and `--rollback-*` flags when using `--mode replicated-job` or `--mode global-job`","Switch to `--mode replicated` (or `global`) if rolling update/rollback behavior is needed"],"exampleFix":"# before\ndocker service create --mode replicated-job --replicas 10 \\\n  --update-parallelism 2 --update-delay 10s --image myjob web\n# error: update and rollback configuration is not supported for jobs\n\n# after (job without update config)\ndocker service create --mode replicated-job --replicas 10 --image myjob web\n\n# after (replicated service with update config)\ndocker service create --mode replicated --replicas 10 \\\n  --update-parallelism 2 --update-delay 10s --image nginx web","handlingStrategy":"validation","validationCode":"// Validate that update/rollback config is not used with job modes\nfunc validateUpdateConfigWithMode(mode swarm.ServiceMode, updateConfig, rollbackConfig *swarm.UpdateConfig) error {\n    if (mode.ReplicatedJob != nil || mode.GlobalJob != nil) && (updateConfig != nil || rollbackConfig != nil) {\n        return errors.New(\"update and rollback configuration is not supported for jobs\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Jobs (replicated-job, global-job) do not support rolling updates or rollbacks — they run to completion","Strip all --update-* and --rollback-* flags when converting a service to a job mode","Only use update/rollback config with replicated or global (long-running) modes"],"tags":["docker","cli","service","swarm","mode-conflict","flag-validation","job"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}