{"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/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/image/push.go#L84-L120","documentation":"Mirror of the pull-side check: docker push --all-tags/-a pushes every local tag of a repository, so the reference must be name-only. In cli/command/image/push.go:101-102, if --all-tags is set and the parsed reference includes a tag or digest, the CLI refuses because the explicit tag contradicts 'push all tags'.","triggerScenarios":"`docker push -a myrepo/app:v1` or `docker push --all-tags registry.example.com/app@sha256:...` — any push combining --all-tags with a tagged or digested reference.","commonSituations":"CI pipelines that build IMAGE:TAG variables and later add --all-tags for release jobs; converting a single-tag push to an all-tags push without stripping the tag; digests left over from an earlier pull-by-digest.","solutions":["Remove the tag when pushing all tags: docker push --all-tags myrepo/app","Or remove --all-tags to push just that one tag: docker push myrepo/app:v1","In CI, derive the repository name (strip ':tag') before invoking push --all-tags"],"exampleFix":"# before\ndocker push --all-tags myrepo/app:v1\n# after\ndocker push --all-tags myrepo/app","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","image-push","all-tags","image-reference","flag-conflict"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}