docker/cli · error

conflicting options: --no-pause and --pause cannot be used t

Error message

conflicting options: --no-pause and --pause cannot be used together

What it means

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.

Source

Thrown at cli/command/container/commit.go:42

	changes opts.ListOpts
}

// newCommitCommand creates a new cobra.Command for `docker commit`
func newCommitCommand(dockerCLI command.Cli) *cobra.Command {
	var options commitOptions

	cmd := &cobra.Command{
		Use:   "commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]",
		Short: "Create a new image from a container's changes",
		Args:  cli.RequiresRangeArgs(1, 2),
		RunE: func(cmd *cobra.Command, args []string) error {
			options.container = args[0]
			if len(args) > 1 {
				options.reference = args[1]
			}
			if cmd.Flag("pause").Changed {
				if cmd.Flag("no-pause").Changed {
					return errors.New("conflicting options: --no-pause and --pause cannot be used together")
				}
				options.noPause = !options.pause
			}
			return runCommit(cmd.Context(), dockerCLI, &options)
		},
		Annotations: map[string]string{
			"aliases": "docker container commit, docker commit",
		},
		ValidArgsFunction:     completion.ContainerNames(dockerCLI, false),
		DisableFlagsInUseLine: true,
	}

	flags := cmd.Flags()
	flags.SetInterspersed(false)

	// TODO(thaJeztah): Deprecated: the --pause flag was deprecated in v29 and can be removed in v30.
	flags.BoolVarP(&options.pause, "pause", "p", true, "Pause container during commit (deprecated: use --no-pause instead)")
	_ = flags.MarkDeprecated("pause", "and enabled by default. Use --no-pause to disable pausing during commit.")

View on GitHub (pinned to e9452d6e78)

Solutions

  1. Use only --no-pause: pass `--no-pause` to skip pausing during commit, or omit it to keep the default pausing behavior.
  2. Remove the deprecated -p/--pause flag from scripts and aliases (it is slated for removal in v30).
  3. Audit wrappers/aliases (`type docker`) to find where the second flag is being injected.

Example fix

# before
docker commit --pause=false --no-pause mycontainer myimage:snapshot
# after
docker commit --no-pause mycontainer myimage:snapshot

When it happens

Trigger: `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.

Common situations: 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.

Related errors


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