LoginSignup
0
0

More than 1 year has passed since last update.

Liberty on Alpine Linux Part2

Last updated at Posted at 2022-11-23

Liberty on Alpine LinuxではibmjavaをAlpine Linuxに導入後、Liberty Serverを導入していました。Alpine Linuxを3.16.3/3.17.0にバージョンアップするとIBM Javaのインストールが失敗してしまう。

JRE libraries are missing or not compatible....

websphere-libertyではIBM JREの8.0.7.20が動いているので、メッセージの通りライブラリが足りないのでしょう。それは別途調べるとして、OpenJDKで試してみた。

Dockerfile例

dockerfile
FROM scratch
ADD alpine-minirootfs-3.17.0-x86_64.tar.gz /

RUN apk update \
    && apk add --no-cache unzip \
    && apk --no-cache --virtual .build-deps add binutils tzdata \
    && cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \
    && echo "Asia/Tokyo" >  /etc/timezone

# Install OpenJDK
ENV JAVA_HOME="/usr/lib/jvm/default-jvm"
RUN apk add openjdk11

# Has to be set explictly to find binaries 
ENV PATH=$PATH:${JAVA_HOME}/bin

# Install WebSphere Liberty
ENV LIBERTY_VERSION 22.0.0.12

ARG LIBERTY_URL 
ARG DOWNLOAD_OPTIONS=""

RUN LIBERTY_URL=${LIBERTY_URL:-$(wget -q -O - https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/downloads/wlp/index.yml  | grep $LIBERTY_VERSION -A 6 | sed -n 's/\s*kernel:\s//p' | tr -d '\r' | head -1)}  \
    && wget -q $DOWNLOAD_OPTIONS $LIBERTY_URL -U UA-IBM-WebSphere-Liberty-Docker -O /tmp/wlp.zip \
    && unzip -q /tmp/wlp.zip -d /opt/ibm \
    && rm /tmp/wlp.zip

ENV LANG=ja_JP.UTF-8 LANGUAGE=ja_JP.UTF-8

RUN /opt/ibm/wlp/bin/server create
RUN /opt/ibm/wlp/bin/installUtility install defaultServer

EXPOSE 9080 9443

CMD ["/opt/ibm/wlp/bin/server", "run", "defaultServer"]

起動すると以下のメッセージが出力された。

OpenJDK 64-Bit Server VM バージョン 11.0.17+8-alpine-r3 (ja_JP) で、defaultServer (WebSphere Application Server 22.0.0.12/wlp-1.0.71.cl221220221107-1900) を起動しています
[監査      ] CWWKE0001I: サーバー defaultServer が起動されました。
[監査      ] CWWKE0100I: この製品は、開発使用向け、および限定的な実動使用向けにライセンスが交付されています。 全ライセンス条項は以下で表示可能です: https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/license/base_ilan/ilan/22.0.0.12/lafiles/ja.html
[警告      ] CWWKF0009W: サーバーは、いずれのフィーチャーもインストールするようには構成されていません。
[監査      ] CWWKF0011I: defaultServer サーバーは、Smarter Planet に対応する準備ができ
ました。defaultServer サーバーは 1.452 秒で始動しました。

すこし調査

IBM Java SDKがインストールできないのを少し調査してみた。
ダウンロード後、「/tmp/ibm-java.bin」となるファイルは実はシェルスクリプトです。デバッグオプションを付けて実行してみた。

/tmp # export LAX_DEBUG=true
/tmp # /tmp/ibm-java.bin  -f /tmp/response.properties
Preparing to install...
Checking for POSIX df.
Found POSIX df.
Checking tail options...
Using tail -n 1.
True location of the self extractor: /tmp/ibm-java.bin
Creating installer data directory: /tmp/install.dir.596
(後は省略)

このインストールシェルの中でJavaが起動されます。それを手で動かしてみた。

/tmp #  /tmp/install.dir.596/Linux/resource/jre/bin/java -version
Error relocating /tmp/install.dir.596/Linux/resource/jre/bin/../lib/amd64/jli/libjli.so: __rawmemchr: symbol not found
Error relocating /tmp/install.dir.596/Linux/resource/jre/bin/../lib/amd64/libdbgwrapper80.so: __strdup: symbol not found
Error relocating /tmp/install.dir.596/Linux/resource/jre/bin/../lib/amd64/libdbgwrapper80.so: __strndup: symbol not found
/tmp #

シンボルが解決できないんですね。犯人はこれかぁ!?

色々試した結果

glibcを2.34-r0から2.35-r0にバージョンアップしたためと判明。
2.34-r0に戻したところ Alpine Linux 3.17.0でも IBM Java SDK をインストールでき、Liberty も起動しました。

IBM J9 VM バージョン 8.0.7.20 - pxa6480sr7fp20-20221020_01(SR7 FP20) (ja_JP) で、defaultServer (WebSphere Application Server 22.0.0.12/wlp-1.0.71.cl221220221107-1900) を起動しています
[AUDIT   ] CWWKE0001I: サーバー defaultServer が起動されました。
[AUDIT   ] CWWKE0100I: この製品は、開発使用向け、および限定的な実動使用向けにライセンスが交付されています。 全ライセ ンス条項は以下で表示可能です: https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/license/base_ilan/ilan/22.0.0.12/lafiles/ja.html
[警告      ] CWWKF0009W: サーバーは、いずれのフィーチャーもインストールするようには構成されていません。
[AUDIT   ] CWWKF0011I: defaultServer サーバーは、Smarter Planet に対応する準備ができました。defaultServer サーバーは 1.974 秒で始動しました。

https://github.com/sgerrand/alpine-pkg-glibc/issues/175
というのを見つけた。「2.35-r0 missing lib64 symlink」とのこと。DockerfileのJDKインストール前に以下をやることで、glibc 2.35 でも動くようになりました。

RUN rm /lib64/ld-linux-x86-64.so.2
RUN ln -s /usr/glibc-compat/lib/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0