docker/build-push-action "tag is needed when pushing to registry" (tags empty)
When push: true, buildx needs at least one tag to name the pushed image. An empty tags input (often a metadata-action output that produced nothing) fails the build.
What this error means
The build-push step fails with "tag is needed when pushing to registry" or an empty tags error.
github-actions
ERROR: tag is needed when pushing to registry
##[error]buildx failed with: ERROR: tag is needed when pushing to registryCommon causes
tags input is empty
No tags were provided, or the upstream metadata-action emitted an empty tags output.
Pushing without a destination
push: true with no fully qualified image:tag gives buildx nowhere to push.
How to fix it
Provide tags (directly or via metadata-action)
- Set tags to a fully qualified image reference, or wire docker/metadata-action outputs.
- Verify the metadata step produced non-empty tags.
- Re-run the build.
.github/workflows/docker.yml
- id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.meta.outputs.tags }}How to prevent it
- Always pair build-push push:true with explicit tags or a metadata-action.
- Assert the metadata tags output is non-empty before pushing.
Related guides
docker/build-push-action "failed to solve" - Buildx not set upFix docker/build-push-action "failed to solve" when docker/setup-buildx-action was not run first.
GitHub Actions docker/metadata-action Produces Empty TagsFix docker/metadata-action emitting no tags - a missing images input, tag rules that match no event, or readi…
GitHub Actions docker/setup-buildx-action Fails to Create the BuilderFix docker/setup-buildx-action failing to bootstrap a builder - a missing QEMU step for cross-arch, an unavai…