{"id":"0bdfce490de63841","repo":"docker/cli","slug":"conflicting-options-no-pause-and-pause-cannot","errorCode":null,"errorMessage":"conflicting options: --no-pause and --pause cannot be used together","messagePattern":"conflicting options: --no-pause and --pause cannot be used together","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/commit.go","lineNumber":42,"sourceCode":"\tchanges opts.ListOpts\n}\n\n// newCommitCommand creates a new cobra.Command for `docker commit`\nfunc newCommitCommand(dockerCLI command.Cli) *cobra.Command {\n\tvar options commitOptions\n\n\tcmd := &cobra.Command{\n\t\tUse:   \"commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]\",\n\t\tShort: \"Create a new image from a container's changes\",\n\t\tArgs:  cli.RequiresRangeArgs(1, 2),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\toptions.container = args[0]\n\t\t\tif len(args) > 1 {\n\t\t\t\toptions.reference = args[1]\n\t\t\t}\n\t\t\tif cmd.Flag(\"pause\").Changed {\n\t\t\t\tif cmd.Flag(\"no-pause\").Changed {\n\t\t\t\t\treturn errors.New(\"conflicting options: --no-pause and --pause cannot be used together\")\n\t\t\t\t}\n\t\t\t\toptions.noPause = !options.pause\n\t\t\t}\n\t\t\treturn runCommit(cmd.Context(), dockerCLI, &options)\n\t\t},\n\t\tAnnotations: map[string]string{\n\t\t\t\"aliases\": \"docker container commit, docker commit\",\n\t\t},\n\t\tValidArgsFunction:     completion.ContainerNames(dockerCLI, false),\n\t\tDisableFlagsInUseLine: true,\n\t}\n\n\tflags := cmd.Flags()\n\tflags.SetInterspersed(false)\n\n\t// TODO(thaJeztah): Deprecated: the --pause flag was deprecated in v29 and can be removed in v30.\n\tflags.BoolVarP(&options.pause, \"pause\", \"p\", true, \"Pause container during commit (deprecated: use --no-pause instead)\")\n\t_ = flags.MarkDeprecated(\"pause\", \"and enabled by default. Use --no-pause to disable pausing during commit.\")","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/commit.go#L24-L60","documentation":"Raised in the RunE of `docker commit` (cli/command/container/commit.go) when both the --pause and --no-pause flags were explicitly set on the same invocation. --pause (default true) is deprecated in v29 in favor of --no-pause; since the two flags express the same setting with opposite polarity, setting both is ambiguous and the command refuses to pick a winner.","triggerScenarios":"`docker commit --pause=false --no-pause mycontainer img:tag` or `docker commit -p --no-pause ...` — any command line where cobra reports both cmd.Flag(\"pause\").Changed and cmd.Flag(\"no-pause\").Changed as true, regardless of the values given.","commonSituations":"Scripts written for older CLIs using -p/--pause that were partially migrated to the new --no-pause flag, leaving both; shell aliases or wrappers that inject one flag while the user passes the other; note the conflict fires even for 'agreeing' combinations like --pause=true --no-pause=false, because both were explicitly set.","solutions":["Use only --no-pause: pass `--no-pause` to skip pausing during commit, or omit it to keep the default pausing behavior.","Remove the deprecated -p/--pause flag from scripts and aliases (it is slated for removal in v30).","Audit wrappers/aliases (`type docker`) to find where the second flag is being injected."],"exampleFix":"# before\ndocker commit --pause=false --no-pause mycontainer myimage:snapshot\n# after\ndocker commit --no-pause mycontainer myimage:snapshot","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","cli-flags","deprecation","commit"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}