Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect "ERROR: tag is needed when pushing to registry" when name is missing #2990

Open
3 tasks done
KonradHoeffner opened this issue Feb 13, 2025 · 1 comment
Open
3 tasks done

Comments

@KonradHoeffner
Copy link

KonradHoeffner commented Feb 13, 2025

Contributing guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

When using buildx with a tag but without a name, it incorrectly reports that a tag is needed.
This can lead to a lot of wasted time when debugging for example GitHub actions where environment variables may be used and one of them is set incorrectly.
The user now expects the environment variable for the tag being empty when in fact it is the name that is missing.

Expected behaviour

docker buildx build . --output type=image,push-by-digest=true,push=true,tag=123 should return:

ERROR: name is needed when pushing to registry

Actual behaviour

docker buildx build . --output type=image,push-by-digest=true,push=true,tag=123 results in:

ERROR: tag is needed when pushing to registry

Buildx version

0.20.1

Docker info


Builders list

NAME/NODE     DRIVER/ENDPOINT   STATUS    BUILDKIT   PLATFORMS
default*      docker                                 
 \_ default    \_ default       running   v0.18.2    linux/amd64 (+3), linux/arm64, linux/arm (+2), linux/ppc64le, (7 more)

Configuration

No Dockerfile needed, this happens even when calling it in a directory without a Dockerfile.

Build logs


Additional info

This seems to be caused by

return errors.Errorf("tag is needed when pushing to registry")
and also in
return errors.Errorf("tag is needed when pushing to registry")
:

pushNames = e.Attrs["name"]
if pushNames == "" {
	return errors.Errorf("tag is needed when pushing to registry")
}
@tonistiigi
Copy link
Member

--tag is the flag of the build command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants