AdoptOpenJDK / openjdk-docker

Scripts for creating Docker images of OpenJDK binaries.

Home Page:https://hub.docker.com/_/adoptopenjdk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

adoptopenjdk:8-*-hotspot on arm32v7 is missing libatomic.so.1

tianon opened this issue · comments

(See also #458 -- this is roughly the same issue, but a different library and a different architecture...)

$ docker pull --platform linux/arm/v7 adoptopenjdk:8-jre-hotspot-focal
8-jre-hotspot-focal: Pulling from library/adoptopenjdk
cd0d4853c44d: Pull complete 
c7d9a278ae85: Pull complete 
af5bd3195024: Pull complete 
c1f8a79f10ee: Pull complete 
fa0c781a5797: Pull complete 
Digest: sha256:eb3d1550e41aae96005a2280eaf73d333da02a906390ad64a0dc527d54befa19
Status: Downloaded newer image for adoptopenjdk:8-jre-hotspot-focal
docker.io/library/adoptopenjdk:8-jre-hotspot-focal

$ docker run --rm --platform linux/arm/v7 adoptopenjdk:8-jre-hotspot-focal java -version
java: error while loading shared libraries: libatomic.so.1: cannot open shared object file: No such file or directory

I think this would be easier to catch if the Dockerfile were updated to also include java -version after Java is downloaded (and I'd recommend adding javac -version on JDK images too).

Concretely, the suggested delta to https://github.com/AdoptOpenJDK/openjdk-docker/blob/e637c8ff34bb4ca7bc14826aaf8bbcc580d5e586/8/jdk/ubuntu/Dockerfile.hotspot.releases.full would be:

diff --git a/8/jdk/ubuntu/Dockerfile.hotspot.releases.full b/8/jdk/ubuntu/Dockerfile.hotspot.releases.full
index b8983020..179fcf2b 100644
--- a/8/jdk/ubuntu/Dockerfile.hotspot.releases.full
+++ b/8/jdk/ubuntu/Dockerfile.hotspot.releases.full
@@ -27,6 +27,9 @@ RUN apt-get update \
     && locale-gen en_US.UTF-8 \
     && rm -rf /var/lib/apt/lists/*
 
+ENV JAVA_HOME=/opt/java/openjdk \
+    PATH="/opt/java/openjdk/bin:$PATH"
+
 ENV JAVA_VERSION jdk8u292-b10
 
 RUN set -eux; \
@@ -65,10 +68,9 @@ RUN set -eux; \
     esac; \
     curl -LfsSo /tmp/openjdk.tar.gz ${BINARY_URL}; \
     echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
-    mkdir -p /opt/java/openjdk; \
-    cd /opt/java/openjdk; \
+    mkdir -p "$JAVA_HOME"; \
+    cd "$JAVA_HOME"; \
     tar -xf /tmp/openjdk.tar.gz --strip-components=1; \
-    rm -rf /tmp/openjdk.tar.gz;
-
-ENV JAVA_HOME=/opt/java/openjdk \
-    PATH="/opt/java/openjdk/bin:$PATH"
+    rm -rf /tmp/openjdk.tar.gz; \
+    javac -version; \
+    java -version;

(That way, the images would only even be published if java is able to run and report its version successfully, instead of catching this in downstream image builds that then fail to run Java.)

FWIW, this PR to official-images created usable arm32v7 images: docker-library/official-images#8918; While this one did not: docker-library/official-images#9063.

Can I grab this? I've got a PR up for it.