docker/cli · error

you must provide one or more flags when using this command

Error message

you must provide one or more flags when using this command

What it means

`docker container update` changes resource limits (CPU, memory, restart policy, pids limit, etc.) on a running container. runUpdate counts how many flags were set (options.nFlag, taken from cmd.Flags().NFlag()) and refuses to proceed when zero, because an update request with no fields would be a no-op API call and is almost certainly user error.

Source

Thrown at cli/command/container/update.go:95

	flags.Var(&options.cpus, "cpus", "Number of CPUs")
	_ = flags.SetAnnotation("cpus", "version", []string{"1.29"})

	_ = cmd.RegisterFlagCompletionFunc("restart", completeRestartPolicies)

	// TODO(thaJeztah): remove in next release (v30.0, or v29.x)
	var stub opts.MemBytes
	flags.Var(&stub, "kernel-memory", "Kernel memory limit (deprecated)")
	_ = flags.MarkDeprecated("kernel-memory", "and no longer supported by the kernel")

	return cmd
}

func runUpdate(ctx context.Context, dockerCli command.Cli, options *updateOptions) error {
	var err error

	if options.nFlag == 0 {
		return errors.New("you must provide one or more flags when using this command")
	}

	var restartPolicy containertypes.RestartPolicy
	if options.restartPolicy != "" {
		restartPolicy, err = opts.ParseRestartPolicy(options.restartPolicy)
		if err != nil {
			return err
		}
	}

	var pidsLimit *int64
	if options.pidsLimit != 0 {
		pidsLimit = &options.pidsLimit
	}

	updateConfig := client.ContainerUpdateOptions{
		Resources: &containertypes.Resources{
			BlkioWeight:        options.blkioWeight,

View on GitHub (pinned to e9452d6e78)

Solutions

  1. Pass at least one resource flag, e.g. `docker update --memory 512m --cpus 1 <container>`.
  2. If you intended to update the image, use `docker pull` plus recreating the container (or docker compose up), not `docker update`.
  3. In scripts, guard the call so it is skipped when no update flags are generated.

Example fix

# before
docker update mycontainer
# after
docker update --restart unless-stopped --memory 1g mycontainer

When it happens

Trigger: Invoking `docker update <container>` (or `docker container update`) with a container name but no option flags at all — nFlag == 0 in runUpdate (cli/command/container/update.go:94).

Common situations: Users expecting `docker update` to refresh/pull an image (it doesn't — it only updates resource configs); scripts where flag values are built from empty environment variables so no flags end up on the command line; confusion with `docker service update`.

Related errors


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