Repository navigation
Closed
Labels
Description
Contributing guidelines
- I've read the contributing guidelines and wholeheartedly agree
I've found a bug, and:
- The documentation does not mention anything about my problem
- There are no open or closed issues that are related to my problem
Description
Hello! I'm using this action together with docker/metadata-action bake file output. I'm using the tags from docker-metadata-action target to generate image name.
Expected behaviour
It should build normally, using the tags from meta action.
Actual behaviour
The action errors out:
Error: docker/bake-action#1 [internal] load local bake definitions
docker/bake-action#1 reading ./docker-bake.hcl 320B / 320B done
docker/bake-action#1 reading /home/runner/work/_temp/docker-actions-toolkit-ZPTkvi/docker-metadata-action-bake-tags.json 247B / 247B done
docker/bake-action#1 reading /home/runner/work/_temp/docker-actions-toolkit-ZPTkvi/docker-metadata-action-bake-labels.json 643B / 643B done
docker/bake-action#1 reading /home/runner/work/_temp/docker-actions-toolkit-ZPTkvi/docker-metadata-action-bake-annotations.json 696B / 696B done
docker/bake-action#1 DONE 0.0s
./docker-bake.hcl:14
--------------------
12 | target "test" {
13 | inherits = ["_common"]
14 | >>> tags = generate_tags("docker.io", target.docker-metadata-action.tags)
15 | }
16 |
--------------------
ERROR: ./docker-bake.hcl:14,37-71: Invalid function argument; Invalid value for "tags" parameter: argument must not be null., and 1 other diagnostic(s)Repository URL
https://github.com/tk-nguyen/docker-bake-demo (master branch is after when I moved the bake file with the tags last)
Workflow run URL
YAML workflow
on:
push:
tags:
- v*.*.*
name: Docker bake test
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}
type=semver,pattern=v{{major}}.{{minor}}
- name: Build and push
uses: docker/bake-action@v4
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
${{ steps.meta.outputs.bake-file-annotations }}
targets: testAdditional info
When I put the bake file with the tags last (either ${{ steps.meta.outputs.bake-file }} or ${{ steps.meta.outputs.bake-file-tags }}), it works perfectly, as seen here: https://github.com/tk-nguyen/docker-bake-demo/actions/runs/8099076031/job/22133989604
Activity
[-]Tags merging problem when using with docker/metadata-action[/-][+]Null value for `tags` when using with `docker/metadata-action` bake file output[/+]austinhallett commentedon Sep 23, 2025
Same issue for me
polarathene commentedon Nov 26, 2025
crazy-max commentedon Nov 26, 2025
When referencing multiple bake definitions in your workflow with first
${{ steps.meta.outputs.bake-file-tags }}that just contains tags like:{ "target":{ "docker-metadata-action":{ "tags":[ "master" ], "args":{ "DOCKER_META_IMAGES":"", "DOCKER_META_VERSION":"master" } } } }And then
${{ steps.meta.outputs.bake-file-labels }}that just contains labels like:{ "target":{ "docker-metadata-action":{ "labels":{ "org.opencontainers.image.created":"2025-11-26T09:01:38.877Z", "org.opencontainers.image.description":"Test \"Docker\" Actions", "org.opencontainers.image.licenses":"MIT", "org.opencontainers.image.revision":"d250fdf571ba0488a715302417e182779e92412e", "org.opencontainers.image.source":"https://github.com/docker/test-docker-action", "org.opencontainers.image.title":"test-docker-action", "org.opencontainers.image.url":"https://github.com/docker/test-docker-action", "org.opencontainers.image.version":"master" } } } }It will fail with:
But not if you're referencing that tags definition last:
Looking at your hcl definition, you are inheriting the
target.docker-metadata-action.tagsattribute: https://docs.docker.com/build/bake/inheritance/#reusing-single-attributes-from-targetsAnd it seems
target.docker-metadata-action.tagsis solved before merging and not after which make it fails when labels definition is the last one.Also when building this bake definition alone you also have the same issue as not tags are defined:
I'm moving this issue to the Buildx repo to address this.
crazy-max commentedon Nov 26, 2025
Ah this is actually already tracked in #3173
polarathene commentedon Nov 28, 2025
So to clarify:
docker/metadata-actionwith all fields, and usedinherits = ["docker-metadata-action"]as instructed by the action docs.targets.docker-metadata-action.tagsreference in a target to pass the tags to a function call for post-processing. This would work fine too.For some unknown reasonthe user additionally added a separate annotations override file fromdocker/metadata-action, and that caused the problem discussed/tracked in Bake: target override using file breaks references to its tags list from other target #3173but beyond that this is misconfiguration as it's redundant?(EDIT: My mistake, annotations is always treated as a separate bake output(src, docs)Placing annotations as an earlier override resolves the issue (provided you don't also need access to it via
target.docker-metadata-action.annotationslike was done with tags) 👍Raised an issue at
docker/metadata-actionfor that specific concern to be resolved (which doesn't need to be dependent upon #3173).