Closed menghuxiashan closed 4 years ago
Apologies for the delayed reply! This issue is caused by zlib symbols remaining in the executable. If you have a version of zlib.so
which was compiled by glibc, then the issue is fixed.
diff --git a/Dockerfile b/Dockerfile
index 16ec3ef..82b2aec 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,6 +6,14 @@ RUN apk --no-cache add ca-certificates wget && \
apk add glibc-2.30-r0.apk && \
apk add glibc-bin-2.30-r0.apk
+WORKDIR /tmp
+RUN wget http://mirror.f4st.host/archlinux/core/os/x86_64/zlib-1:1.2.11-4-x86_64.pkg.tar.xz -O ./libz.tar.xz && \
+ tar -xf ./libz.tar.xz && \
+ cp /tmp/usr/lib/libz.so.1.2.11 /usr/glibc-compat/lib/libz.so.1.2.11 && \
+ rm -fr /tmp/usr /tmp/libz.tar.xz
+WORKDIR /
+RUN /usr/glibc-compat/sbin/ldconfig
+
RUN mkdir -p /usr/java/
ADD jdk-11.0.5_linux-x64_bin.tar.gz /usr/java/
ENV JAVA_HOME=/usr/java/jdk-11.0.5
$ docker build . --pull --tag issue-129
Sending build context to Docker daemon 180MB
Step 1/10 : FROM alpine:latest
latest: Pulling from library/alpine
Digest: sha256:b276d875eeed9c7d3f1cfa7edb06b22ed22b14219a7d67c52c56612330348239
Status: Image is up to date for alpine:latest
---> a187dde48cd2
Step 2/10 : RUN apk --no-cache add ca-certificates wget && wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.30-r0/glibc-2.30-r0.apk && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.30-r0/glibc-bin-2.30-r0.apk && apk add glibc-2.30-r0.apk && apk add glibc-bin-2.30-r0.apk
---> Using cache
---> d6e160de90f4
Step 3/10 : WORKDIR /tmp
---> Running in 965efa6c4390
Removing intermediate container 965efa6c4390
---> 1783f00b579c
Step 4/10 : RUN wget http://mirror.f4st.host/archlinux/core/os/x86_64/zlib-1:1.2.11-4-x86_64.pkg.tar.xz -O ./libz.tar.xz && tar -xf ./libz.tar.xz && cp /tmp/usr/lib/libz.so.1.2.11 /usr/glibc-compat/lib/libz.so.1.2.11 && rm -fr /tmp/usr /tmp/libz.tar.xz
---> Running in 4af34f80d44c
--2020-04-01 15:43:24-- http://mirror.f4st.host/archlinux/core/os/x86_64/zlib-1:1.2.11-4-x86_64.pkg.tar.xz
Resolving mirror.f4st.host... 144.76.111.189, 2a01:4f8:192:61b4::5003
Connecting to mirror.f4st.host|144.76.111.189|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 83444 (81K) [application/octet-stream]
Saving to: './libz.tar.xz'
0K .......... .......... .......... .......... .......... 61% 723K 0s
50K .......... .......... .......... . 100% 101M=0.07s
2020-04-01 15:43:25 (1.15 MB/s) - './libz.tar.xz' saved [83444/83444]
Removing intermediate container 4af34f80d44c
---> 89dcfdcf92a2
Step 5/10 : WORKDIR /
---> Running in ce7605e10d1b
Removing intermediate container ce7605e10d1b
---> 61e35aa08f99
Step 6/10 : RUN /usr/glibc-compat/sbin/ldconfig
---> Running in a85b095830c5
/usr/glibc-compat/sbin/ldconfig: /usr/glibc-compat/lib/ld-linux-x86-64.so.2 is not a symbolic link
Removing intermediate container a85b095830c5
---> b8edeb70d11e
Step 7/10 : RUN mkdir -p /usr/java/
---> Running in f28dfbd5f9c6
Removing intermediate container f28dfbd5f9c6
---> 73928af33133
Step 8/10 : ADD jdk-11.0.5_linux-x64_bin.tar.gz /usr/java/
---> 7903df118872
Step 9/10 : ENV JAVA_HOME=/usr/java/jdk-11.0.5
---> Running in 3c1769e17e67
Removing intermediate container 3c1769e17e67
---> 6a410684c27b
Step 10/10 : ENV PATH ${PATH}:${JAVA_HOME}/bin
---> Running in 4c94c3e26d46
Removing intermediate container 4c94c3e26d46
---> a9c58358a159
Successfully built a9c58358a159
Successfully tagged issue-129:latest
$ docker run --rm issue-129 java -version
java version "11.0.5" 2019-10-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.5+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.5+10-LTS, mixed mode)
My Dockerfile:
when enter alpine-jdk container and input "java -version", infos:
Is there any problem in my Dockfile ?