{"record":{"id":"cf749087c6307d88","repo":"docker/cli","slug":"tag-can-t-be-used-with-all-tags-a-cf7490","errorCode":null,"errorMessage":"tag can't be used with --all-tags/-a","messagePattern":"tag can't be used with --all-tags/-a","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/image/push.go","lineNumber":102,"sourceCode":"\t\t\t_, _ = fmt.Fprintf(dockerCli.Err(), \"Invalid platform %s\", opts.platform)\n\t\t\treturn err\n\t\t}\n\t\tplatform = &p\n\n\t\tout.PrintNote(`Using --platform pushes only the specified platform manifest of a multi-platform image index.\nOther components, like attestations, will not be included.\nTo push the complete multi-platform image, remove the --platform flag.\n`)\n\t}\n\n\tref, err := reference.ParseNormalizedNamed(opts.remote)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch {\n\tcase opts.all && !reference.IsNameOnly(ref):\n\t\treturn errors.New(\"tag can't be used with --all-tags/-a\")\n\tcase !opts.all && reference.IsNameOnly(ref):\n\t\tref = reference.TagNameOnly(ref)\n\t\tif tagged, ok := ref.(reference.Tagged); ok && !opts.quiet {\n\t\t\t_, _ = fmt.Fprintln(dockerCli.Out(), \"Using default tag:\", tagged.Tag())\n\t\t}\n\t}\n\n\t// Resolve the Auth config relevant for this server\n\tencodedAuth, err := command.RetrieveAuthTokenFromImage(dockerCli.ConfigFile(), ref.String())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresponseBody, err := dockerCli.Client().ImagePush(ctx, reference.FamiliarString(ref), client.ImagePushOptions{\n\t\tAll:           opts.all,\n\t\tRegistryAuth:  encodedAuth,\n\t\tPrivilegeFunc: nil,\n\t\tPlatform:      platform,","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/image/push.go#L84-L120","documentation":"runPush() applies the same all-tags guard as pull: pushing with -a only makes sense for a name-only repository reference. Specifying a tag/digest together with --all-tags is contradictory, so it is rejected before the push API call.","triggerScenarios":"`docker push -a myimage:latest` or `docker push --all-tags myimage@sha256:...`.","commonSituations":"Reusing a tagged reference from a pull/build in an all-tags push; CI templating that always emits a tag.","solutions":["Drop the tag to push all tags: `docker push -a myimage`","Drop -a to push one tag: `docker push myimage:latest`","Decide between pushing all tags or one specific tag"],"exampleFix":"// before\ndocker push -a myimage:latest\n// after\ndocker push -a myimage","handlingStrategy":"validation","validationCode":"ref, err := reference.ParseNormalizedNamed(opts.remote)\nif err != nil { return err }\nif opts.all && !reference.IsNameOnly(ref) {\n    return errors.New(\"--all-tags requires a name-only reference without tag/digest\")\n}","typeGuard":"func isNameOnlyRef(s string) bool {\n    ref, err := reference.ParseNormalizedNamed(s)\n    if err != nil { return false }\n    return reference.IsNameOnly(ref)\n}","tryCatchPattern":null,"preventionTips":["Use -a only with a bare repository name (no :tag or @digest)","Templating that always emits a tag must not also set --all-tags","Validate name-only-ness of the reference before pushing all tags"],"tags":["images","registry","cli","validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}