[JAVA] Liberty on Docker

Create the Liberty execution environment on Docker. You can use websphere-liberty, but I want to translate it into Japanese & I want to understand the Dockerfile and mechanism, so I wrote a Dockerfile. It was. In addition to websphere-liberty, ibmjava is also referred to.

ibmjava: 8-jre is FROM ubuntu:18.04.3 ⇒ IBM JRE installation. websphere-liberty FROM ibmjava:8-jre ⇒ Liberty installation. Install and translate this into alpine linux, IBM JRE, liberty.

Dockerfile example

dockerfile


FROM scratch
ADD alpine-minirootfs-3.12.0-x86_64.tar.gz /

RUN apk update \
    && ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" \
    && ALPINE_GLIBC_PACKAGE_VERSION="2.31-r0" \
    && ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" \
    && ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" \
    && ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" \
    && 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 \
    && wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
    && wget -q "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
               "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
               "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" \
    && apk add --no-cache \
           "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
           "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
           "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" \
    && rm  "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
           "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
           "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" \
    && /usr/glibc-compat/bin/localedef -i ja_JP -f UTF-8 ja_JP.UTF-8 \
    && GCC_LIBS_URL="https://archive.archlinux.org/packages/g/gcc-libs/gcc-libs-8.3.0-1-x86_64.pkg.tar.xz" \
    && wget -q -O /tmp/gcc-libs.tar.xz ${GCC_LIBS_URL} \
    && mkdir /tmp/gcc \
    && tar -xf /tmp/gcc-libs.tar.xz -C /tmp/gcc \
    && mv /tmp/gcc/usr/lib/libgcc* /tmp/gcc/usr/lib/libstdc++* /usr/glibc-compat/lib \
    && strip /usr/glibc-compat/lib/libgcc_s.so.* /usr/glibc-compat/lib/libstdc++.so* \
    && apk del --purge .build-deps \
    && apk add --no-cache ca-certificates openssl \
    && rm -rf /tmp/gcc-libs.tar.xz /tmp/gcc

ENV JAVA_VERSION 1.8.0_sr6fp11

RUN set -eux; \
    YML_FILE='jre/linux/x86_64/index.yml'; \
    BASE_URL="https://public.dhe.ibm.com/ibmdl/export/pub/systems/cloud/runtimes/java/meta/"; \
    wget -q -U UA_IBM_JAVA_Docker -O /tmp/index.yml ${BASE_URL}/${YML_FILE}; \
    JAVA_URL=$(sed -n '/^'${JAVA_VERSION}:'/{n;s/\s*uri:\s//p}'< /tmp/index.yml); \
    wget -q -U UA_IBM_JAVA_Docker -O /tmp/ibm-java.bin ${JAVA_URL}; \
    echo "INSTALLER_UI=silent" > /tmp/response.properties; \
    echo "USER_INSTALL_DIR=/opt/ibm/java" >> /tmp/response.properties; \
    echo "LICENSE_ACCEPTED=TRUE" >> /tmp/response.properties; \
    mkdir -p /opt/ibm; \
    chmod +x /tmp/ibm-java.bin; \
    /tmp/ibm-java.bin -i silent -f /tmp/response.properties; \
    rm -f /tmp/response.properties /tmp/index.yml /tmp/ibm-java.bin

# Install WebSphere Liberty
ENV LIBERTY_VERSION 20.0.0_07

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' )}  \
    && 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 JAVA_HOME=/opt/ibm/java/jre \
    PATH=/opt/ibm/java/jre/bin:/opt/ibm/wlp/bin:$PATH \
    IBM_JAVA_OPTIONS="-XX:+UseContainerSupport" \
    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"]

Startup message

When started, the following message was output.

IBM J9 VM version 8.0.6.11 - pxa6480sr6fp11-20200602_01(SR6 FP11) (ja_JP)And defaultServer(WebSphere Application Server 20.0.0.7/wlp-1.0.42.cl200720200625-0300)Is running
[AUDIT   ] CWWKE0001I:The server defaultServer has been started.
[AUDIT   ] CWWKE0100I:This product is licensed for development use and limited production use. All license terms can be viewed below: https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/license/base_ilan/ilan/20.0.0.7/lafiles/ja.html
[warning] CWWKF0009W:The server is not configured to install any of the features.
[AUDIT   ] CWWKF0011I:The defaultServer server is ready for Smarter Planet. defaultServer server is 2.It started in 961 seconds.

Feature

-It is based on Alpine and is built from scratch. ・ It has been translated into Japanese. -The latest version of IBM JRE and Liberty as of July 8, 2020 is used. -I want to run / opt / ibm / wlp / bin / client etc., so I don't use links such as / config.

index.yml has been updated. If it hasn't been updated, download it directly instead of getting the path from index.yml. You can download it when you build Docker, or you can copy the pre-downloaded one.

RUN LIBERTY_URL=https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/downloads/wlp/20.0.0.6/wlp-kernel-20.0.0.6.zip

websphere-liberty is 20.0.0.6, but JRE is fp10.

docker run --rm websphere-liberty

Launching defaultServer (WebSphere Application Server 20.0.0.6/wlp-1.0.41.cl200620200528-0414) on IBM J9 VM, version 8.0.6.10 - pxa6480sr6fp10-20200408_01(SR6 FP10) (en_US)
[AUDIT   ] CWWKE0001I: The server defaultServer has been launched.
~

Impressions

Looking at the contents of alpine-minirootfs-3.9.3-x86_64.tar.gz, it is an impression that busybox is amazing. It's a substitute for just a few commands.

busybox --help
BusyBox v1.29.3 (2019-01-24 07:45:07 UTC) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2015.
Licensed under GPLv2. See source distribution for detailed
copyright notices.

Usage: busybox [function [arguments]...]
   or: busybox --list[-full]
   or: busybox --install [-s] [DIR]
   or: function [arguments]...

        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as.

Currently defined functions:
        [, [[, acpid, add-shell, addgroup, adduser, adjtimex, arch, arp, arping, ash, awk, base64, basename,
        bbconfig, beep, blkdiscard, blkid, blockdev, brctl, bunzip2, bzcat, bzip2, cal, cat, chgrp, chmod,
        chown, chpasswd, chroot, chvt, cksum, clear, cmp, comm, conspy, cp, cpio, crond, crontab, cryptpw, cut,
        date, dc, dd, deallocvt, delgroup, deluser, depmod, df, diff, dirname, dmesg, dnsdomainname, dos2unix,
        du, dumpkmap, dumpleases, echo, ed, egrep, eject, env, ether-wake, expand, expr, factor, fallocate,
        false, fatattr, fbset, fbsplash, fdflush, fdformat, fdisk, fgrep, find, findfs, flock, fold, free,
        fsck, fstrim, fsync, fuser, getopt, getty, grep, groups, gunzip, gzip, halt, hd, hdparm, head, hexdump,
        hostid, hostname, hwclock, id, ifconfig, ifdown, ifenslave, ifup, init, inotifyd, insmod, install,
        ionice, iostat, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink, ipneigh, iproute, iprule, iptunnel, kbd_mode,
        kill, killall, killall5, klogd, less, link, linux32, linux64, ln, loadfont, loadkmap, logger, login,
        logread, losetup, ls, lsmod, lsof, lspci, lsusb, lzcat, lzma, lzop, lzopcat, makemime, md5sum, mdev,
        mesg, microcom, mkdir, mkdosfs, mkfifo, mkfs.vfat, mknod, mkpasswd, mkswap, mktemp, modinfo, modprobe,
        more, mount, mountpoint, mpstat, mv, nameif, nanddump, nandwrite, nbd-client, nc, netstat, nice, nl,
        nmeter, nohup, nologin, nproc, nsenter, nslookup, ntpd, od, openvt, partprobe, passwd, paste, patch,
        pgrep, pidof, ping, ping6, pipe_progress, pkill, pmap, poweroff, powertop, printenv, printf, ps, pscan,
        pstree, pwd, pwdx, raidautorun, rdate, rdev, readahead, readlink, readprofile, realpath, reboot,
        reformime, remove-shell, renice, reset, resize, rev, rfkill, rm, rmdir, rmmod, route, run-parts, sed,
        sendmail, seq, setconsole, setfont, setkeycodes, setlogcons, setpriv, setserial, setsid, sh, sha1sum,
        sha256sum, sha3sum, sha512sum, showkey, shred, shuf, slattach, sleep, smemcap, sort, split, stat,
        strings, stty, su, sum, swapoff, swapon, switch_root, sync, sysctl, syslogd, tac, tail, tar, tee, test,
        time, timeout, top, touch, tr, traceroute, traceroute6, true, truncate, tty, ttysize, tunctl, udhcpc,
        udhcpc6, umount, uname, unexpand, uniq, unix2dos, unlink, unlzma, unlzop, unshare, unxz, unzip, uptime,
        usleep, uudecode, uuencode, vconfig, vi, vlock, volname, watch, watchdog, wc, wget, which, whoami,
        whois, xargs, xxd, xzcat, yes, zcat

BusyBox 1.29.3 is included in alpine-minirootfs-3.9.3-x86_64.tar.gz. BusyBox 1.30.1 has been released, but even if you look at alpine-minirootfs-3.9.4-x86_64.tar.gz, BusyBox is still 1.29.3 (^^; alpine-minirootfs-3.10.0-x86_64) .tar.gz has been updated to BusyBox 1.30.1.

bonus

minirootfs aports It's easy with scripts / genrootfs.sh. After creating busybox-1.30.1 under main / busybox, try using it.

./genrootfs.sh -o test-x86_64.tar.gz busybox-1.30.1-r1.apk \
    ssl_client-1.30.1-r1.apk \
    alpine-baselayout alpine-keys apk-tools libc-utils

As of 8/26, alpine: latest Dockerfile was as follows.

FROM scratch
ADD alpine-minirootfs-3.10.2-x86_64.tar.gz /
CMD ["/bin/sh"]

Reference link

How_to_make_a_custom_ISO_image_with_mkimage Create a package for Alpine Linux

The sites I want to check are as follows. · IBM JRE https://public.dhe.ibm.com/ibmdl/export/pub/systems/cloud/runtimes/java/meta/jre/linux/x86_64/index.yml ・ Liberty https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/downloads/wlp/index.yml

Liberty will be released It's in Recommended updates for WebSphere Application Server, but it's just a plan, so it's often faster.

change history

(2019/6/22) Rootfs changed from 3.9.3 to 3.10.0, Liberty changed to 19.0.0_06 (2019/6/27) Since keytool gives the following error, add host name change Unable to create default SSL certificate. keytool error (may be in English): java.lang.RuntimeException: java.io.IOException: Invalid IPAddressName 992fdba70de5 (2019/7/11) Changed jre to 1.8.0_sr5fp37. Deleted copy of server.xml and ear. Deleted the setting part of the host name. (2019/7/24) Dealing with versions not in index.yml Add. 19.0.0.7 etc. (2019/8 / 1x?) [index.yml] https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/downloads/wlp/index.yml) has been updated. So I changed the base Liberty to 19.0.0.7. (2019/8/21) JRE is upgraded to 1.8.0_sr5fp40 and Liberty is upgraded to 19.0.0.8. (2019/8/26) Changed the version of alpine linux to 3.10.2. Changed the version of ALPINE_GLIBC to 2.30. (2019/9/15) Liberty is upgraded to 19.0.0.9. (2019/9/29) Added about 8.0.5.41 of jre. (2019/10/11) Liberty's 19.0.0.10 has been released. index.yaml has also been updated. (2019/10/22) Fixed the part that could not be updated to Liberty-19.0.0.10. (2019/10/23) Updated rootfs of Alpine to 3.10.3. (2019/11/13) Liberty is upgraded to 19.0.0.11. (2020/3/6) Liberty is upgraded to 20.0.0.2, Alpine's rootfs is upgraded to 3.11.3, and jre is upgraded to 8.0.6.5. (2020/3/24) Liberty is upgraded to 20.0.0.3 and Alpine's rootfs is upgraded to 3.11.5. (2020/4/12) Liberty is upgraded to 20.0.0.4 and jre is upgraded to 8.0.6.7. However, Liberty is not yet in index.yml. (2020/4/15) Liberty-20.0.0.4 has been added to index.yml, so it has been corrected. Fixed Liberty version specification. (2020/5/8) Liberty is upgraded to 20.0.0.5 and jre is upgraded to 8.0.6.10. Fixed. Fixed Liberty version specification. (2020/5/23) Alpline linux was upgraded to 3.11.6, and the status of websphere-liberty was updated. (2020/6/12) Alpline linux upgraded to 3.12.0 and Liberty upgraded to 20.0.0.6. (2020/6/27) Upgraded jre to 8.0.6.11. (2020/7/8) Liberty is upgraded to 20.0.0.7.

Recommended Posts

Liberty on Docker
Redmine on Docker
Docker installation on CentOS 6
python notes on docker
Install Docker on Manjaro
M.S. docker on Windows
Docker installation on WSL2
Run phpunit on Docker
Install Docker on Raspberry Pi
Install Docker on Windows 10 PRO
Run VS Code on Docker
Enable HTTPS on WebSphere Liberty
Install Docker on Ubuntu Server 20.04
Run openvpn on Docker (windows)
Try Docker on Windows 10 Home
Oracle Java 8 on Docker Ubuntu
Hosted Apicurio Studio on Docker
Install docker on AWS EC2
docker
Install openjdk8 on Docker image (Debian)
Install Docker on AWS Ubunt 20.04 LTS
Run SSE (Server-Sent-Event) samples on docker
Steps to run docker on Mac
Run puppeteer-core on Heroku (Docker edition)
Try using Redmine on Mac docker
Use Docker Compose on Windows 10 Home
JMeter Client/Server Remote Testing on Docker
To beginners launching Docker on AWS
Run React on a Docker container
Docker on NILFS2 filesystem (for raspbianOS)
Run the AWS CLI on Docker
How to run JavaFX on Docker
Run GUI application on Docker container
WordPress with Docker Compose on CentOS 8
Build Clang x VSCode on Docker (1)
Deploy Flask's Docker image on Heroku
Use Docker on your M1 Mac
Rails on Docker environment construction procedure
Run PureScript on a Docker container
Try Docker on Windows Home (September 2020)
Deploy Rails on Docker to heroku
Using Docker on Windows10 Home WSL2
Use Docker CE (official) on CentOS 8
Build Unity development environment on docker
Easily try C # 9 (.NET 5) on Docker
docker memo
Windows Docker: Disk pressure on WSL files
Publish Docker Image on GitHub Package Registry
Install docker and docker-compose on Alpine Linux
kubernetes + docker
spring × docker
About Docker
I tried running Docker on Windows Server 2019
Launch docker container on EC2 (personal memorandum)
Customize OpenFOAM v8 Docker Image on Mac
Run NordVPN on Docker (Windows) Ubuntu container
Run Embulk on Docker to convert files
Docker Intellij
I installed Docker on my Raspberry Pi 3
Docker basics
Use docker in proxy environment on ubuntu 20.04.1