Is it possible to Build Image for a certain Platform Architecture
See original GitHub issueEnvironment:
- com.google.cloud.tools.jib: 3.2.1
- Gradle 7.4.2
JVM: 18.0.1.1 (Oracle Corporation 18.0.1.1+2-6) OS: Mac OS X 12.4 x86_64
Description of the issue: Cant find any method to build image for a certain platform architecture
Steps to reproduce:
jib-gradle-plugin
Configuration:
jib.to {
image = 'localhost:5000/nginx_new'
platforms {
platform {
architecture = 's390x'
os = 'linux'
}
}
}
Log output:
* What went wrong:
A problem occurred evaluating root project
> Could not find method platforms() for arguments [build_e470sv26omxhc01p0di2zc0og$_run_closure3$_closure6@2920b0ff] on object of type com.google.cloud.tools.jib.gradle.TargetImageParameters.
Additional info:
Looking for similar features with docker buildx Example
docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64
Issue Analytics
- State:
- Created a year ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Multi-platform images | Docker Documentation
Docker images can support multiple platforms, which means that a single image may contain variants for different architectures, and sometimes for different ...
Read more >Building Multiplatform Container Images the Easy Way
This post will show how with just a little work we were able to create Trow images for both ARM and Intel platforms....
Read more >Building Docker images for multiple operating system ...
In this post I'll discuss how to build Docker images within CI pipelines that target multiple processor architectures such as linux/amd64, ...
Read more >Easily Making Container Images for Multiple Platforms - Medium
The first thing I needed was the ability to create container images for multiple platforms in one location. Doing some research, I discovered ......
Read more >Building Multi-CPU Architecture Docker Images for ARM and ...
As `buildx/buildkit` will build docker images for all target platforms simultaneously using one single Dockerfile. Your Dockerfile is required to be able to ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Let’s say you have a
java.exe
executable binary on your Windows laptop. It’s a Windows binary compiled on Windows to be able to run on Windows. If you copy thatjava.exe
file into a Linux laptop and try to execute it there, obviously, it won’t run. Likewise, the JVM you have in your base image is anamd64
binary. Thejava
binary is compiled onamd64
to be able to run onamd64
. The JVM cannot run onarm64
, because it’s just a different platform. To build anarm64
image with Jib, you need to supply a base image where there is anarm64
JVM.The warning means that you showed Jib the intention to build an
arm64
image, but the JVM base image you supplied is anamd64
image. The resulting image built by Jib is unquestionably anamd64
image. It will run fine onamd64
, but it won’t run onarm64
. Jib doesn’t allow you to forcibly and falsely marking the resulting image as anarm64
image, because it is not anarm64
image and it simply doesn’t make sense.This time, you showed the intention to create two images: one for
arm64
and the other foramd64
. However, as I said, to be able to build them, you need to provide two base images for the two different platforms: one forarm64
and the other foramd64
. Apparently, the base image***/java-13-base
is a single image whose JVM is anamd64
binary. Therefore, the base image reference in this case should be a manifest list (it’s just a small JSON file listing pointers to multiple images) that contains at least botharm64
andamd64
.Almost all popular JDK/JRE images referenced by tags on Docker Hub are manifest lists. For example, you can see below that
openjdk:17-oracle
is a manifest list containing pointers to two images foramd64
andarm64
.So, if you specify
openjdk:17-oracle
as a base image and configure botharm64
andamd64
, Jib will build botharm64
andamd64
images, create a manifest list pointing to those two built images, and upload the two images as well as the manifest list to the target registry. I suggest you to try out this kind of manifest list just to see how it works out.You showed the intention to create a Windows image. Therefore, there should be a Windows base image containing a Windows JVM to begin with.
jenkins/jenkins
is a manifest list, but it doesn’t contain a pointer to a Windows image. There is no way Jib can build a Windows image. (BTW, even if the manifest list had a Windows image, Jib doesn’t yet support building a Windows image, so it would fail to build anyway.)To sum up, if you want to build an
arm64
(or Windows) image, you need to supply anarm64
(or Windows) base image to Jib. If you only supply anamd64
base image, what you can build is only anamd64
image. Jib won’t allow you to arbitrarily call theamd64
image anarm64
(or Windows) image, because it doesn’t make sense and won’t work anyway onarm64
(or Windows). That’s why you specify platforms underjib.from
.It worked !! 👍
@chanseokoh much appreciate your support and guidelines.
For reference attaching
build.gradle
and respective results.Output indicates architectures available with the new Image.