docker-maven-plugin
docker-maven-plugin copied to clipboard
Multi-Arch support
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 : You can build 0.40-SNAPSHOT
version locally to try it out.
I'll try to release 0.40.0 this weekend.
Thanks @rohanKanojia
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/
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
Hi @rohanKanojia I see the fix for this issue has already been committed. When would you release the next build?
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 same happening to me
did you figure out the issue?
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
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.
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.
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 #1665