Closed carpnick closed 2 years ago
Doing some initial research this line may be the culprit. Saw this issue in moby: https://github.com/moby/buildkit/issues/1241
Doing some initial research this line may be the culprit. Saw this issue in moby: moby/buildkit#1241
Makes sense... But we also have
To avoid "jmods: Value too large for defined data type" error,
on top of the FROM
.
I guess I can try a proposal and build it on my machines, but let's hope an expert will chime in.
Thanks a lot for your report.
Thanks a lot @carpnick for raising this issue and sharing the potential solution!
Looks like we forgot to remove the --platform
flag for this image because https://github.com/jenkinsci/docker-agent/blob/master/11/bullseye/Dockerfile#L23 does not have the flag.
@carpnick are you ok to open a pull request, this is a nice contribution!
As I suspected, we're back to the first error.
I wonder if the first error is related to QEMU 32bit/64 problem : https://bugs.launchpad.net/qemu/+bug/1805913 which then gets redirected to https://gitlab.com/qemu-project/qemu/-/issues/263
Until QEMU resolves - supporting arm32 in this repo will block folks trying to use arm64. This PR it was introduced for ARM32
I plead guilty.
Would be worth using a multi-stage Dockerfile
to fix this:
FROM eclipse-temurin:17.0.4.1_1-jdk-focal AS jre-build
by default to fix the issue hereFROM --platform=linux/arm32 eclipse-temurin:17.0.4.1_1-jdk-focal AS arm32-jre-build
WDYT?
Great!
How would it work @dduportal ? We have 2 images and need to selectively copy based on a special platform. COPY --from
doesnt support conditionals. We need a conditional somewhere that says "when this platform use image 1, when not use image 2`.
This is me thinking out loud. I have been trying this locally and can't think of a way to do this without separating the docker files.
The line that controls this assuming you get multistage working:
COPY --from=jre-build /javaruntime $JAVA_HOME
Looking into docker-bake to see if we can do anything there
@carpnick your analysis is correct: docker bake would be where the "condtionnal" would be by defining 2 different "targets" pointing to a Dockerfile targets each on the same Dockerfile
I would love to try something, but I won't be able to address that before Wednesday.
@gounthar and @dduportal - Thoughts - https://github.com/jenkinsci/docker-agent/pull/310
I looked into this more and jlinks is not working for arm/v7. I tried manually and even loading in some config tools. I am not an expert on java compilation. So instead I took the approach that we just outright copy the java runtime as is in the arm32 case. I consider this the best answer of a bad situation due to the error we are running into. I think us playing with BUILDPLATFORM environment is the wrong choice as we will run into this same error with potentially a different platform. So the least risky way to go about it also increases docker image file size (at least with my knowledge).
If we think it is good - I will clean it up properly.
Looks like a good a approach to me
I haven't had a thorough look yet, but what do you mean by
jlinks is not working for arm/v7
and
the java runtime as is in the arm32 case
For me, linux/armv7
is a synonym for arm32
in the Docker world. Sorry if I muddy the water. 😊
@gounthar - sorry for not being clear. The --platform
has to match one of the OS/Arch of the image we are using and so the only option was to set like this. That yielded the same error result:
@gounthar and @dduportal - Thoughts - #310
I looked into this more and jlinks is not working for arm/v7. I tried manually and even loading in some config tools. I am not an expert on java compilation. So instead I took the approach that we just outright copy the java runtime as is in the arm32 case. I consider this the best answer of a bad situation due to the error we are running into. I think us playing with BUILDPLATFORM environment is the wrong choice as we will run into this same error with potentially a different platform. So the least risky way to go about it also increases docker image file size (at least with my knowledge).
If we think it is good - I will clean it up properly.
Make sense : the additional size is not a problem if it is only on the arm32 images.
Thank you all for feedback. I think #310 is ready to go.
Jenkins and plugins versions report
Environment
```text uname -a Linux ip-.x.x.x.x.compute.internal 4.14.291-218.527.amzn2.aarch64 #1 SMP Fri Aug 26 09:54:28 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux ```What Operating System are you using (both controller, and any agents involved in the problem)?
Reproduction steps
Try 1
docker pull jenkins/agent:3071.v7e9b_0dc08466-1-jdk17
docker run -it --entrypoint /bin/bash jenkins/agent:3071.v7e9b_0dc08466-1-jdk17
a. Runjava
within the container, error happens below:bash: /opt/java/openjdk/bin/java: cannot execute binary file: Exec format error
Try 2
Also tried the ARM64 specific image:
docker run -it --entrypoint /bin/bash jenkins/agent:3071.v7e9b_0dc08466-1-jdk17@sha256:bc386f73b3654d7ccaa73060ee66453be35795eb48d9d670d0eaeaa38e16688e
bash: /opt/java/openjdk/bin/java: cannot execute binary file: Exec format error
Try3
If I use the preview image it works...
docker run -it --entrypoint /bin/bash jenkins/agent:latest-jdk17-preview
Command Output
``` jenkins@a44fdd3f66c0:~$ java Usage: java [options]