docker/cli · error

tag can't be used with --all-tags/-a

Error message

tag can't be used with --all-tags/-a

What it means

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'.

Source

Thrown at cli/command/image/push.go:102

			_, _ = fmt.Fprintf(dockerCli.Err(), "Invalid platform %s", opts.platform)
			return err
		}
		platform = &p

		out.PrintNote(`Using --platform pushes only the specified platform manifest of a multi-platform image index.
Other components, like attestations, will not be included.
To push the complete multi-platform image, remove the --platform flag.
`)
	}

	ref, err := reference.ParseNormalizedNamed(opts.remote)
	if err != nil {
		return err
	}

	switch {
	case opts.all && !reference.IsNameOnly(ref):
		return errors.New("tag can't be used with --all-tags/-a")
	case !opts.all && reference.IsNameOnly(ref):
		ref = reference.TagNameOnly(ref)
		if tagged, ok := ref.(reference.Tagged); ok && !opts.quiet {
			_, _ = fmt.Fprintln(dockerCli.Out(), "Using default tag:", tagged.Tag())
		}
	}

	// Resolve the Auth config relevant for this server
	encodedAuth, err := command.RetrieveAuthTokenFromImage(dockerCli.ConfigFile(), ref.String())
	if err != nil {
		return err
	}

	responseBody, err := dockerCli.Client().ImagePush(ctx, reference.FamiliarString(ref), client.ImagePushOptions{
		All:           opts.all,
		RegistryAuth:  encodedAuth,
		PrivilegeFunc: nil,
		Platform:      platform,

View on GitHub (pinned to e9452d6e78)

Solutions

  1. Remove the tag when pushing all tags: docker push --all-tags myrepo/app
  2. Or remove --all-tags to push just that one tag: docker push myrepo/app:v1
  3. In CI, derive the repository name (strip ':tag') before invoking push --all-tags

Example fix

# before
docker push --all-tags myrepo/app:v1
# after
docker push --all-tags myrepo/app

When it happens

Trigger: `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.

Common situations: 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.

Related errors


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