-
|
I'm using matrix to generate multiple images like target "base" {
matrix = {
version = ["20.04", "22.04", "24.04"]
}
name = "ubuntu-${replace(version, ".", "")}"
tags = ["my/image:ubuntu-${version}"]
...
}Is there any way to re-tag images without overriding original tags like we do in command line? docker tag my/image:ubuntu-24.04 my/image:ubuntu-latestI currently push docker images directly with - uses: docker/bake-action@v5
with:
push: true
set: |
ubuntu-2404.tags = [<original tags ...>, "my/image:ubuntu-latest"]But in this way I need to rewrite the whole array instead of just adding a tag. Is there any way to achieve something like - uses: docker/bake-action@v5
with:
push: true
set: |
ubuntu-2404.tags += ["my/image:ubuntu-latest"]So that we don't need to touch any existing tags? Alt solutions (My workarounds)I'm currently using a new target as the original one as its context. target "latest" {
inherits = ["ubuntu-2404"]
contexts = {
"my/image:ubuntu-24.04" = "target:ubuntu-2404"
}
tags = ["my/image:ubuntu-latest"]
}I also saw a 4yo discussion docker/buildx#427 to allow optional tagging. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Does that not work? It is supported with You can use UPDATE: It was answered here that you can use that |
Beta Was this translation helpful? Give feedback.
Yes indeed,
+=operator to append with overrides is supported since Buildx v0.22.0: docker/buildx#3031More info: https://docs.docker.com/reference/cli/docker/buildx/bake/#set