{"record":{"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/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/container/commit.go#L24-L60","documentation":"newCommitCommand (cli/command/container/commit.go:28) wires both --pause/-p and --no-pause flags. In RunE at line 40-43, if the user explicitly set --pause AND explicitly set --no-pause, it returns errors.New(\"conflicting options: --no-pause and --pause cannot be used together\"). These flags are logical opposites (pause vs. don't pause the container during commit); --pause is also deprecated in favor of --no-pause.","triggerScenarios":"Running `docker commit --pause --no-pause <id>` or `docker commit -p --no-pause <id>`. Both flags have their Changed flag set because the user (or a wrapper) passed both.","commonSituations":"Aliases/scripts that append --no-pause colliding with a user's --pause; copy-pasting flags from old docs (when --pause was the norm) alongside new --no-pause; refactors that didn't remove the deprecated flag.","solutions":["Use only --no-pause (the current recommended flag) to disable pausing; pausing is the default, so to pause just omit the flag.","Remove any deprecated --pause/-p from your alias or command.","Note --pause is deprecated since v29 and slated for removal; migrate to --no-pause."],"exampleFix":"# before\ndocker commit --pause --no-pause web myimg\n# after — pausing is default; use --no-pause only to disable it\ndocker commit web myimg\n# or to explicitly not pause\ndocker commit --no-pause web myimg","handlingStrategy":"validation","validationCode":"// In a wrapper, reject the combination before invoking docker:\nif hasPause && hasNoPause {\n    return errors.New(\"--pause and --no-pause are mutually exclusive\")\n}","typeGuard":null,"tryCatchPattern":"if err := cmd.Execute(); err != nil {\n    if strings.Contains(err.Error(), \"--no-pause and --pause cannot be used together\") {\n        // remove one flag and retry / inform user\n    }\n}","preventionTips":["Migrate off the deprecated --pause/-p; use --no-pause only to disable pausing.","Audit aliases that pass both flags.","Pausing is the default — omit both flags to pause during commit."],"tags":["container","commit","conflicting-flags","deprecated"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}