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

docker platform variable does not accept an array of String #747

Open
peterzxu-crm opened this issue Jun 3, 2024 · 1 comment
Open

docker platform variable does not accept an array of String #747

peterzxu-crm opened this issue Jun 3, 2024 · 1 comment

Comments

@peterzxu-crm
Copy link

What happened?

I want to use buildx to build cross platforms. I am seeing that there is a platform variable to specify. However, it does not work for me. If I specify

docker { platform ['linux/amd64'] }

The debug shows that it does not add --platform parameter at all.

But if I specify

docker { platform 'linux/amd64' }

it complains about

`

No signature of method: static com.google.common.collect.ImmutableSet.copyOf() is applicable for argument types: ([Ljava.lang.String;) values: [[linux/amd64]]
Possible solutions: copyOf(java.lang.Iterable), of(), of([Ljava.lang.Object;), of(java.lang.Object), count(java.lang.Object), count(groovy.lang.Closure)
`

What did you want to happen?

I expect that if I specify platform ['linux/amd64'], it should add to command line --platform linux/amd64

@spatcho
Copy link

spatcho commented Oct 7, 2024

Had same issue and did dig into plugin code. There is an undocumented param 'buildx' that need to be true for param like 'platform' to be considered. Then you could write like this :

docker {
...
buildx true
platform 'linux/amd64'
...
}

A list of strings is supported, i.e. { platform 'linux/amd64','linux/arm64' }, but then :

ERROR: Multi-platform build is not supported for the docker driver.
Switch to a different driver, or turn on the containerd image store, and try again.
Learn more at https://docs.docker.com/go/build-multi-platform/

But that is docker related, not an issue with this plugin

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

No branches or pull requests

2 participants