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
Returned by runUpdate when options.nFlag is 0, meaning the user invoked `docker update` with no resource-limit flags at all. The update command's whole purpose is to change live container constraints (CPU, memory, restart policy, pids), so providing none is a no-op the CLI rejects early at update.go:94-96.
Solutions
- Add at least one resource flag, e.g. `docker update --cpus 2 c1` or `docker update --memory 512m c1`.
- If scripting, ensure your flag builder appends at least one limit before invoking docker.
- To inspect limits use `docker inspect`, not `docker update`.
Example fix
// before docker update c1 // after docker update --cpus 2 --memory 512m c1
Defensive patterns
Strategy: validation
Validate before calling
func validateUpdate(changedFlags int) error {
if changedFlags == 0 {
return errors.New("you must provide one or more flags when using this command")
}
return nil
}
// count the resource flags you intend to set before invoking docker update. Prevention
- Require at least one resource flag in your update wrapper.
- Use `docker inspect` (not `docker update`) to read current limits.
- Surface a clear usage message if no resource flags are supplied.
When it happens
Trigger: `docker update c1` with no --memory, --cpus, --restart, --pids-limit, etc. nFlag counts changed flags; zero triggers the error.
Common situations: Forgetting the actual limit flag after the container name. Scripts building the flag list dynamically that produce an empty list. Trying to use `docker update` merely to inspect (wrong command).
Related errors
- invalid storage option
- valid streams are STDIN, STDOUT and STDERR
- cannot attach to a stopped container, start it first
- cannot attach to a paused container, unpause it first
- cannot attach to a restarting container, wait until it is…
AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07).
Data as JSON: /api/errors/c200871ebd1b7d9c.
Report an issue: GitHub.
Appendix: 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 4f84911bfe)