Under ARM64 architecture, OpenJDK official version 8 Docker mirror why not?

Why Docker mirror ARM64 architecture of OpenJDK8

Existing Java application, until running in x86 processor environment, compile and run all JDK8, now run Docker environment Raspberry Pi in need JDK8 image as a base image.

OpenJDK official Dockerfile

OpenJDK docker to the official website to find a mirror to find, the address is: https: //hub.docker.com/r/arm64v8/openjdk, as shown below, only JDK11 the mirror:
Here Insert Picture Description

Why not mirrored OpenJDK8

Slightly unwilling to mind, trying to figure out why not, to explore;

  1. Open OpenJDK8 official GitHub, to see the script Dockerfile make a mirror image of the source code, the address is: https: //github.com/docker-library/openjdk/blob/master/8/jdk/Dockerfile, note the contents of the following figure:
    Here Insert Picture Description
  2. From the analysis of the chart we learned OpenJDK8 mirroring process: first get the current host processor architecture, run a $ (dpkg---print Architecture) , raspberries come in order to try to do this, as can be seen We got $ (dpkg---print Architecture) :
root@raspbian:~# echo $(dpkg --print-architecture)
arm64
  1. Code 3 in FIG fancy red box, if the processor architecture is arm64 , then the variable upstreamArch equal to aarch64 ;
  2. 看上图红框4中的代码,下载OpenJDK包的地址是${JAVA_BASE_URL}KaTeX parse error: Expected group after '_' at position 21: …reamArch}_linux_̲{JAVA_URL_VERSION}.tar.gz,这里面JAVA_BASE_URL、upstreamArch、JAVA_URL_VERSION的值都已经确定了,于是真实的地址就是:
https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jdk_aarch64_linux_8u222b10.tar.gz
  1. 在浏览器输入上述地址试试,发现浏览器返回的是404错误,也就是说此地址无效;
  2. 将上述地址中的aarch64替换成x64,看看X86处理机架构下有没有OpenJDK8的下载包,新地址是:https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jdk_x64_linux_8u222b10.tar.gz ,此地址可以顺利下载;
  3. 来看看OpenJDK官方为JDK8版本提供了哪些下载包,地址是:https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases ,如下图,清一色的x86架构:
    Here Insert Picture Description

结论

OpenJDK官方镜像的制作原理,是依据宿主机CPU架构去官方下载对应的OpenJDK安装包,再做成镜像,目前OpenJKD8的安装包并没有提供ARM版本,因此官方没有提供ARM版本的OpenJDK8的Docker镜像;

解决之道

现状是OpenJDK官方在ARM64架构不提供8版本的官方Docker镜像,解决此问题的思路有两个(个人观点,欢迎探讨)

  1. To compile a version of the OpenJDK 8 installation package, in order to do Docker mirror;
  2. Oracle provides the ARM version of JDKD installation package, this package do Docker mirror;
  3. But the differences were 11 and 8 to be treated with their own version of the OpenJDK 11;

For the first way, compile their own version of the OpenJDK 8, too difficult (For myself), because the compiler needs low OpenJDK version of OpenJDK as the compilation tools, which means I have to find ARM version of OpenJDK7, to compile ARM version of OpenJDK8, so I think that the difficulty of doing too much ...

For the second and third, subsequent chapters we work together to combat it;

Published 328 original articles · won praise 946 · Views 1.17 million +

Guess you like

Origin blog.csdn.net/boling_cavalry/article/details/101908575