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

Native platform image also forcely built with buildx config [native arch forcely added] #1572

Closed
voloshanenko opened this issue Jun 20, 2022 · 2 comments · Fixed by #1577
Closed

Comments

@voloshanenko
Copy link

Description

When we used buildx config and set non-native platform only, like
<buildx> <platforms> <platform>linux/amd64</platform> </platforms> </buildx>
for as example linux/arm64 (M1 Pro)

Plugin will as second step also build image for the native platform due to

buildX(buildX, builderName, buildDirs, imageConfig, Collections.singletonList(dockerAccess.getNativePlatform()), buildArchive, "--load");

and will fail in our case as PARENT image not availbale for linux/arm64 (openjdk17-alpine)
[INFO] DOCKER> error: failed to solve: openjdk:17-jdk-alpine: no match for platform in manifest sha256:4b6abae565492dbe9e7a894137c966a7485154238902f2f25e9dbd9784383d81: not found

In general we understand rationality for such behavoiur, but it's hard-coded, which make it very hard to use on M1 pro only for package phase for CI/CD.
Can we make it configurable (enabled by default, but with opportunity to disable)

As dirty workaround - we modify Dockerfile, and forcely set FROM --platform=linux/amd64 - but this is not the fancy fix, and destroy all idea of multiarch builds

Info

  • docker-maven-plugin version : 0.40.1
  • Maven version (mvn -v) : 3.8.6

  • Docker version : 20.10.16
  • If it's a bug, how to reproduce : any buildx config when only non-native platform listed
@voloshanenko voloshanenko changed the title Native platform forcely build with buildx config Native platform image also forcely built with buildx config [native arch forcely added] Jun 20, 2022
@tbfky
Copy link
Contributor

tbfky commented Jun 30, 2022

Just ran in to this issue as well, and I don't agree that it makes sense at all, if you configure the platforms you want to build for using the buildx/platform(s) option it should build for those platforms and no other?

Documentation also states: specifying platform to build

A list of <platform> elements specifying platform to build. A platform has syntax of OS/architecture (e.g. linux/amd64, linux/arm64, darwin/amd64).

@marcelstoer
Copy link
Contributor

marcelstoer commented Jul 1, 2022

I'm curious to learn what @chonton's thoughts were when he implemented that. The use-case described by @voloshanenko maybe wasn't on the radar? IMO this shouldn't be a hard-coded behavior.

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

Successfully merging a pull request may close this issue.

3 participants