0

I am trying to build an docker image out of my IntelliJ. It is a Java (openjdk:20) project. I need to have the image as an linux/arm/v7 to run on a raspberry pi 2. But when I try to build the image a get the following error: ERROR: failed to solve: openjdk:20: no match for platform in manifest

When I run docker buildX ls I see that I should be able to build it:

NAME/NODE       DRIVER/ENDPOINT STATUS  BUILDKIT                              PLATFORMS
default         docker                                                        
  default       default         running v0.11.7-0.20230525183624-798ad6b0ce9f linux/arm64, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
desktop-linux * docker                                                        
  desktop-linux desktop-linux   running v0.11.7-0.20230525183624-798ad6b0ce9f linux/arm64, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6

I am using this command:

docker buildx build --platform linux/arm/v7 --tag testarmv7 .

My Dockerfile looks like this:

FROM openjdk:20

ENV ENVIRONMENT=prod

LABEL maintainer="XXX"

EXPOSE 8080

ADD backend/target/capstone.jar app.jar

CMD [ "sh", "-c", "java -jar /app.jar" ]

I really appreciate any help I can get!

I tried to change the jdk to 17, 11 and 8, but it didnt solve the problem.

4ctive
  • 3
  • 1
  • Does this answer your question? [Build linux/arm64 docker image on linux/amd64 host](https://stackoverflow.com/questions/70757791/build-linux-arm64-docker-image-on-linux-amd64-host) – life888888 Aug 20 '23 at 15:35
  • No, thats another problem. I have listed the platform I need ("linux/arm/v7"), but am not able to run the build with it... – 4ctive Aug 20 '23 at 16:12

2 Answers2

0

I'm not expert of ARM, however I can give you some hint.

openjdk:20 is available for arm64/v8, not for arm/v7 which is 32 bit (see this page). It is also a bit old and vulnerable, furthermore the openjdk repository on Docker Hub is deprecated (see the deprecation notice).

arm32v7/eclipse-temurin has recent images but it supports up to Java 17. Do you really use some Java 20 feature? I have not found a pre-built image of Java 20 for arm/v7, however consider that Java 17 is the latest LTS so it is not obsolete.

arm32v7/eclipse-temurin offers both JDK and JRE images. It seems that you need just a JRE but you were trying to use a JDK which is bigger; I recommend arm32v7/eclipse-temurin:17-jre.

Pino
  • 7,468
  • 6
  • 50
  • 69
0

OpenJDK is deprecated and will not work with your architecture. try with this Dockerfile:

FROM arm32v7/eclipse-temurin:17-jammy

ENV ENVIRONMENT=prod

LABEL maintainer="XXX"

EXPOSE 8080

ADD backend/target/capstone.jar app.jar

CMD [ "sh", "-c", "java -jar /app.jar" ]

The image arm32v7/eclipse-temurin:17-jammy is a little downgrade from the JDK 20 but will work on your machine. Also the eclipse-temurin offers the JRE only if you needed.

Francesco
  • 171
  • 8