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.
2
Answers
I’m not expert of ARM, however I can give you some hint.
The
openjdk
repository on Docker Hub is deprecated (see the deprecation notice).openjdk:20
is available forarm64/v8
, not forarm/v7
which is 32 bit (see this page). It is also a bit old and vulnerable.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
.OpenJDK is deprecated and will not work with your architecture. try with this Dockerfile:
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.