{"id":"c200871ebd1b7d9c","repo":"docker/cli","slug":"you-must-provide-one-or-more-flags-when-using-this","errorCode":null,"errorMessage":"you must provide one or more flags when using this command","messagePattern":"you must provide one or more flags when using this command","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/update.go","lineNumber":95,"sourceCode":"\n\tflags.Var(&options.cpus, \"cpus\", \"Number of CPUs\")\n\t_ = flags.SetAnnotation(\"cpus\", \"version\", []string{\"1.29\"})\n\n\t_ = cmd.RegisterFlagCompletionFunc(\"restart\", completeRestartPolicies)\n\n\t// TODO(thaJeztah): remove in next release (v30.0, or v29.x)\n\tvar stub opts.MemBytes\n\tflags.Var(&stub, \"kernel-memory\", \"Kernel memory limit (deprecated)\")\n\t_ = flags.MarkDeprecated(\"kernel-memory\", \"and no longer supported by the kernel\")\n\n\treturn cmd\n}\n\nfunc runUpdate(ctx context.Context, dockerCli command.Cli, options *updateOptions) error {\n\tvar err error\n\n\tif options.nFlag == 0 {\n\t\treturn errors.New(\"you must provide one or more flags when using this command\")\n\t}\n\n\tvar restartPolicy containertypes.RestartPolicy\n\tif options.restartPolicy != \"\" {\n\t\trestartPolicy, err = opts.ParseRestartPolicy(options.restartPolicy)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar pidsLimit *int64\n\tif options.pidsLimit != 0 {\n\t\tpidsLimit = &options.pidsLimit\n\t}\n\n\tupdateConfig := client.ContainerUpdateOptions{\n\t\tResources: &containertypes.Resources{\n\t\t\tBlkioWeight:        options.blkioWeight,","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/update.go#L77-L113","documentation":"`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.","triggerScenarios":"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).","commonSituations":"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`.","solutions":["Pass at least one resource flag, e.g. `docker update --memory 512m --cpus 1 <container>`.","If you intended to update the image, use `docker pull` plus recreating the container (or docker compose up), not `docker update`.","In scripts, guard the call so it is skipped when no update flags are generated."],"exampleFix":"# before\ndocker update mycontainer\n# after\ndocker update --restart unless-stopped --memory 1g mycontainer","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","container","flags","resource-limits"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}