docker-maven-plugin icon indicating copy to clipboard operation
docker-maven-plugin copied to clipboard

Multi-Arch support

Open viragtripathi opened this issue 2 years ago • 14 comments

Description

I followed the multi-arch example with buildx but it seems like this is not released yet as the example shows a snapshot version of docker-maven-plugin. When will be the new version released with Multi-Arch build support? Thanks!

  • docker-maven-plugin version : 0.39.1

  • Maven version (mvn -v) : 3.8.2

  • Docker version : 20.10.14 (Docker Desktop 4.8.2)

  • If it's a feature request, what is your use case : Multi-arch support using buildx or any other prescribed methods

viragtripathi avatar May 23 '22 03:05 viragtripathi

@viragtripathi : You can build 0.40-SNAPSHOT version locally to try it out.

I'll try to release 0.40.0 this weekend.

rohanKanojia avatar May 26 '22 09:05 rohanKanojia

Thanks @rohanKanojia

viragtripathi avatar May 26 '22 15:05 viragtripathi

0.40.0 is out. Please try it out and provide us feedback.

https://repo1.maven.org/maven2/io/fabric8/docker-maven-plugin/0.40.0/

rohanKanojia avatar May 29 '22 18:05 rohanKanojia

Thanks @rohanKanojia. I just tried the latest build and ran into issue with Dockerfile. I think others are encountering the same issue with Dockerfile.

[INFO] DOCKER> error: failed to solve: failed to read dockerfile: open /tmp/buildkit-mount1310305077/Dockerfile: no such file or directory

viragtripathi avatar May 31 '22 03:05 viragtripathi

Hi @rohanKanojia I see the fix for this issue has already been committed. When would you release the next build?

viragtripathi avatar Jun 02 '22 04:06 viragtripathi

Hi @rohanKanojia Thanks for the latest build with the fix. I tried it and the project builds fine now with buildx configuration. I provided linux/amd64,linux/arm64 under buildx platform and I can see that generated DOCKER command has both but when I look up the manifest, it only shows amd64 as the os architecture. Am I missing something here?

viragtripathi avatar Jun 13 '22 17:06 viragtripathi

@viragtripathi same happening to me

did you figure out the issue?

asad-awadia avatar Aug 31 '22 12:08 asad-awadia

Hello, there are two problems:

  • first the BuildX service on the buildAndLoadNativePlatform checks if you are building for your native platform (if not you will throw, so no building for other platforms other than your own), and on the same checks overrides the given platform list with just the native platform (hence you will build just for your platform)
  • second, even if this is fixed (just pass the platform list instead of a singleton list), docker is at the moment broken and the build will fail with: DOCKER> ERROR: docker exporter does not currently support exporting manifest lists

This last one is neither a plugin issue nor a buildx issue (see: https://github.com/docker/buildx/issues/59#issuecomment-1168619521), but instead a limitation of docker which is being tracked by this upstream issue: https://github.com/docker/roadmap/issues/371

mdgomes avatar Nov 23 '22 14:11 mdgomes

Unfortunately, the local docker cache can only hold one image per name. So it makes sense to only build into the local repository the native image. Now a remote registry can hold multi-architecture indices (multiple platforms sharing the same name), so the push goal can build and push non-native images.

Yes, this is unexpected. But, this is the way docker buildx works.

chonton avatar Feb 13 '23 23:02 chonton

I understand that due to current limitations in docker it's not possible to build and load a multiarch image locally. However, shouldn't it be possible to build and load a single-architecture but still non-native image? I have a use-case where that would be handy. I'm on an M1 mac but need to build and test an amd64 image, preferably before I push it to a remote repository.

martyvona avatar Apr 11 '23 16:04 martyvona

Sure, your use is valid, but not the usual case. I would willing to review a Pull Request that adds a buildx option that will load a non-native image to the local cache.

chonton avatar Apr 11 '23 19:04 chonton

@chonton #1665

martyvona avatar Apr 11 '23 21:04 martyvona