이 글은 2022.8.1에 기존 T-Story 블로그에 작성했던 글 입니다. (https://with-kami.tistory.com/1534843)
안녕하세요.
‘수상한 김토끼’ 입니다.
Oracle의 WebLogic Image Tool을 활용하여 WebLogic Docker Image 만들기를 진행 해 보겠습니다.
이 블로그 글은 미들웨어 경험이 없으신 분들도 쉽게 따라 하실 수 있도록 쉽게 작성하는 것이 목표입니다.
설명을 보고 진행하시다가 궁금하신 내용은 댓글로 문의하시면 가능한 범위 내에서 알려 드리도록 하겠습니다.
1. WebLogic Image Tool 소개
WebLogic Image Tool은 On-prem에서 사용하는 WebLogic 솔루션을 Docker Image 생성할 수 있는 도구입니다.
기존에 사용하던 WebLogic을 컨테이너 서비스로 사용해야 할 때 도움을 받을 수 있으며
몇 가지 준비사항만으로 쉽게 변환이 가능한 도구입니다.
물론 이런 도구를 사용하지 않고 직접 Docker Image를 작성할 수도 있겠지만 이번에는 WebLogic Image Tool을 활용한 Docker Image 생성에 대해 알아보도록 하겠습니다.
https://oracle.github.io/weblogic-image-tool
2. 설치준비
WebLogic Image Tool을 사용하기 위해서는 첫번째로 Docker 환경이 필요합니다.
공식 홈페이지에 따르면 다음과 같은 제약사항을 확인할 수 있습니다.
- A container image client on the build machine, such as Docker or Podman.
- For Docker, a minimum version of 18.03.1.ce is required.
- For Podman, a minimum version of 3.0.1 is required.
- An installed version of Java to run Image Tool, version 8+.
- Installers for Oracle WebLogic Server and Oracle JDK from the Oracle Software Delivery Cloud for installation into the new image.
- When using the imagetool alias from setup.sh instead of the shell script (imagetool.sh), Bash version 4.0 or later is required for <tab> command completion.
- When using any of the patching options, --patches, --recommendedPatches, or --latestPSU, you will need to provide Oracle Support credentials.
https://oracle.github.io/weblogic-image-tool/userguide/prerequisites
OS 및 Docker 환경구성등은 이번장에서는 다루지 않겠습니다.
사용하는 OS에 맞는 Docker 환경 구성을 진행 후 다음을 진행 해 주세요.
저는 CentOS 8 64bit에 Docker 20.10.17 버전을 사용 했습니다.
[root@middleware-works-centos8]# cat /etc/redhat-release CentOS Stream release 8 [root@middleware-works-centos8]# docker --version Docker version 20.10.17, build 100c701
Docker 환경이 준비되었다면 이제 github에서 Weblogic Image Tool을 다운로드 받아줍니다.
https://github.com/oracle/weblogic-image-tool
아래와 같이 Code 탭에서 ‘Download ZIP’을 선택하여 파일을 다운로드 후 서버로 옮겨 줍니다.

서버에서 zip 파일 압축을 풀어줍니다.
[root@middleware-works-centos8 tmp]# pwd /home/opc/downloads/tmp [root@middleware-works-centos8 tmp]# ls imagetool.zip [root@middleware-works-centos8 tmp]# unzip imagetool.zip Archive: imagetool.zip creating: imagetool/ creating: imagetool/bin/ inflating: imagetool/bin/setup.sh inflating: imagetool/bin/logging.properties inflating: imagetool/bin/imagetool.cmd inflating: imagetool/bin/imagetool.sh inflating: imagetool/LICENSE.txt creating: imagetool/lib/ inflating: imagetool/lib/imagetool_completion.sh inflating: imagetool/lib/imagetool.jar inflating: imagetool/VERSION.txt inflating: imagetool/lib/fluent-hc-4.5.12.jar inflating: imagetool/lib/httpclient-4.5.12.jar inflating: imagetool/lib/httpcore-4.4.13.jar inflating: imagetool/lib/commons-logging-1.2.jar inflating: imagetool/lib/commons-codec-1.11.jar inflating: imagetool/lib/httpmime-4.5.12.jar inflating: imagetool/lib/picocli-4.6.1.jar inflating: imagetool/lib/json-20200518.jar inflating: imagetool/lib/compiler-0.9.10.jar [root@middleware-works-centos8 tmp]# ls imagetool imagetool.zip
여기까지 WebLogic Image tool 사용을 위한 설치 준비가 마무리 되었습니다.
3. WebLogic 및 JDK 설치파일 등록
WebLogic Image Tool을 사용하기 위해서는 만들고 싶은 버전의 WebLogic 설치파일을 다운로드 해야 합니다.
공식 홈페이지의 quick start에 나와 있는 그대로 해당 파일을 준비 해 줍니다.
https://oracle.github.io/weblogic-image-tool/quickstart/quickstart
본 예제에서는 quick start와 같이 다음 2개의 파일을 가지고 진행하겠습니다.
1. fmw_12.2.1.3.0_wls_Disk1_1of1.zip
2. jdk-8u202-linux-x64.tar.gz
해당 파일을 다운로드 받아 서버에 업로드 해 줍니다.
[root@middleware-works-centos8 tmp]# pwd /home/opc/downloads/tmp/tmp [root@middleware-works-centos8 tmp]# ls fmw_12.2.1.3.0_wls_Disk1_1of1.zip jdk-8u202-linux-x64.tar.gz
설치에 필요한 파일 준비가 완료되었습니다.
이제 이 2개 파일을 WebLogic Image Tool에서 인식 할 수 있도록 등록이 필요합니다.
zip 파일 압축을 풀었던 경로의 bin 아래로 이동하여 다음 명령(imagetool.sh)을 통해 파일을 등록 해 줍니다.
(명령어의 대소문자에 유의하여 입력해 주세요.)
jdk 등록: ./imagetool.sh cache addInstaller --type jdk --version 8u202 --path /home/opc/downloads/jdk-8u202-linux-x64.tar.gz
wls 등록: ./imagetool.sh cache addInstaller --type wls --version 12.2.1.3.0 --path /home/opc/downloads/fmw_12.2.1.3.0_wls_Disk1_1of1.zip
cache 확인: ./imagetool.sh cache listItems
[root@middleware-works-centos8 bin]# pwd /home/opc/wlit/imagetool/bin [root@middleware-works-centos8 bin]# ls imagetool.cmd imagetool.sh logging.properties setup.sh [root@middleware-works-centos8 bin]# ./imagetool.sh cache listItems Cache contents cache.dir=/root/cache [root@middleware-works-centos8 bin]# ./imagetool.sh cache addInstaller --type jdk --version 8u202 --path /home/opc/downloads/jdk-8u202-linux-x64.tar.gz [INFO ] Successfully added to cache. jdk_8u202=/home/opc/downloads/jdk-8u202-linux-x64.tar.gz [root@middleware-works-centos8 bin]# ./imagetool.sh cache addInstaller --type wls --version 12.2.1.3.0 --path /home/opc/downloads/fmw_12.2.1.3.0_wls_Disk1_1of1.zip [INFO ] Successfully added to cache. wls_12.2.1.3.0=/home/opc/downloads/fmw_12.2.1.3.0_wls_Disk1_1of1.zip [root@middleware-works-centos8 bin]# ./imagetool.sh cache listItems Cache contents cache.dir=/root/cache jdk_8u202=/home/opc/downloads/jdk-8u202-linux-x64.tar.gz wls_12.2.1.3.0=/home/opc/downloads/fmw_12.2.1.3.0_wls_Disk1_1of1.zip
여기까지 WebLogic 및 JDK 등록 과정이 완료 되었습니다.
4. WebLogic Docker Image 파일 생성
모든 준비가 끝났으니 create 명령으로 WebLogic Docker Image 파일을 생성 해 줍니다.
생성은 다음 명령으로 수행할 수 있으며 Docker Image tag 지정이 필요합니다.
Docker Image 생성: ./imagetool.sh create --tag wls:12.2.1.3.0
[root@middleware-works-centos8 bin]# ls imagetool.cmd imagetool.sh logging.properties setup.sh [root@middleware-works-centos8 bin]# pwd /home/opc/wlit/imagetool/bin [root@middleware-works-centos8 bin]# ./imagetool.sh create --tag wls:12.2.1.3.0 [INFO ] WebLogic Image Tool version 1.11.2 [INFO ] Image Tool build ID: 51c8ba6b-30e9-4302-a018-a1513f41dafb [INFO ] Temporary directory used for image build context: /root/wlsimgbuilder_temp7662993480612690079 [INFO ] Copying /home/opc/downloads/jdk-8u202-linux-x64.tar.gz to build context folder. [INFO ] Using middleware installers (wls) version 12.2.1.3.0 [INFO ] Copying /home/opc/downloads/fmw_12.2.1.3.0_wls_Disk1_1of1.zip to build context folder. [INFO ] Starting build: docker build --no-cache --force-rm --tag wls:12.2.1.3.0 /root/wlsimgbuilder_temp7662993480612690079 Sending build context to Docker daemon 1.033GB Step 1/27 : FROM ghcr.io/oracle/oraclelinux:8-slim as os_update 8-slim: Pulling from oracle/oraclelinux e54b73e95ef3: Pulling fs layer e54b73e95ef3: Verifying Checksum e54b73e95ef3: Download complete e54b73e95ef3: Pull complete Digest: sha256:6bc31f1f8e3681d7ae8c114077cd9ab79b12c501baf7f96cfca7356f907fbce2 Status: Downloaded newer image for ghcr.io/oracle/oraclelinux:8-slim ---> c7c0b3ae3077 Step 2/27 : LABEL com.oracle.weblogic.imagetool.buildid="51c8ba6b-30e9-4302-a018-a1513f41dafb" ---> Running in 9b93dda45ec1 Removing intermediate container 9b93dda45ec1 ---> 911c249319cd Step 3/27 : USER root ---> Running in f01bf025f4b6 Removing intermediate container f01bf025f4b6 ---> 661e7648aa7a Step 4/27 : RUN microdnf update && microdnf install gzip tar unzip libaio jq findutils diffutils shadow-utils && microdnf clean all ---> Running in fd7f2bfac303 Downloading metadata... Downloading metadata... Nothing to do. Package Repository Size Installing: diffutils-3.6-6.el8.x86_64 ol8_baseos_latest 369.3 kB findutils-1:4.6.0-20.el8.x86_64 ol8_baseos_latest 540.6 kB gzip-1.9-13.el8_5.x86_64 ol8_baseos_latest 170.7 kB jq-1.6-3.el8.x86_64 ol8_appstream 206.7 kB libaio-0.3.112-1.el8.x86_64 ol8_baseos_latest 33.4 kB oniguruma-6.8.2-2.el8.x86_64 ol8_appstream 191.8 kB tar-2:1.30-5.el8.x86_64 ol8_baseos_latest 857.9 kB unzip-6.0-46.el8.x86_64 ol8_baseos_latest 200.5 kB Transaction Summary: Installing: 8 packages Reinstalling: 0 packages Upgrading: 0 packages Obsoleting: 0 packages Removing: 0 packages Downgrading: 0 packages Downloading packages... Running transaction test... Installing: oniguruma;6.8.2-2.el8;x86_64;ol8_appstream Installing: jq;1.6-3.el8;x86_64;ol8_appstream Installing: unzip;6.0-46.el8;x86_64;ol8_baseos_latest Installing: tar;2:1.30-5.el8;x86_64;ol8_baseos_latest Installing: libaio;0.3.112-1.el8;x86_64;ol8_baseos_latest Installing: gzip;1.9-13.el8_5;x86_64;ol8_baseos_latest Installing: findutils;1:4.6.0-20.el8;x86_64;ol8_baseos_latest Installing: diffutils;3.6-6.el8;x86_64;ol8_baseos_latest Complete. Complete. Removing intermediate container fd7f2bfac303 ---> 5daafa0ce8df Step 5/27 : RUN if [ -z "$(getent group oracle)" ]; then groupadd oracle || exit 1 ; fi && if [ -z "$(getent group oracle)" ]; then groupadd oracle || exit 1 ; fi && if [ -z "$(getent passwd oracle)" ]; then useradd -g oracle oracle || exit 1; fi && mkdir -p /u01 && chown oracle:oracle /u01 && chmod 775 /u01 ---> Running in 2bd7f1988c44 Removing intermediate container 2bd7f1988c44 ---> fcccf2392b0a Step 6/27 : FROM os_update as jdk_build ---> fcccf2392b0a Step 7/27 : LABEL com.oracle.weblogic.imagetool.buildid="51c8ba6b-30e9-4302-a018-a1513f41dafb" ---> Running in 6f9a8477dbfe Removing intermediate container 6f9a8477dbfe ---> 53b9cf2db0e6 Step 8/27 : ENV JAVA_HOME=/u01/jdk ---> Running in b0eb9ba58efc Removing intermediate container b0eb9ba58efc ---> e348dc98f1bd Step 9/27 : COPY --chown=oracle:oracle jdk-8u202-linux-x64.tar.gz /tmp/imagetool/ ---> 4e8d9a9546d8 Step 10/27 : USER oracle ---> Running in 2a638de6b24b Removing intermediate container 2a638de6b24b ---> 125fb4077f71 Step 11/27 : RUN tar xzf /tmp/imagetool/jdk-8u202-linux-x64.tar.gz -C /u01 && $(test -d /u01/jdk* && mv /u01/jdk* /u01/jdk || mv /u01/graal* /u01/jdk) && rm -rf /tmp/imagetool && rm -f /u01/jdk/javafx-src.zip /u01/jdk/src.zip ---> Running in e89ba0f9a46c Removing intermediate container e89ba0f9a46c ---> 5ca9baa155e4 Step 12/27 : FROM os_update as wls_build ---> fcccf2392b0a Step 13/27 : LABEL com.oracle.weblogic.imagetool.buildid="51c8ba6b-30e9-4302-a018-a1513f41dafb" ---> Running in 54f9004282dd Removing intermediate container 54f9004282dd ---> 9b3e91c39b1b Step 14/27 : ENV JAVA_HOME=/u01/jdk ORACLE_HOME=/u01/oracle OPATCH_NO_FUSER=true ---> Running in 7967afc895a1 Removing intermediate container 7967afc895a1 ---> 43ee30ba805c Step 15/27 : RUN mkdir -p /u01/oracle && mkdir -p /u01/oracle/oraInventory && chown oracle:oracle /u01/oracle/oraInventory && chown oracle:oracle /u01/oracle ---> Running in 1172ba5543f5 Removing intermediate container 1172ba5543f5 ---> 928427585992 Step 16/27 : COPY --from=jdk_build --chown=oracle:oracle /u01/jdk /u01/jdk/ ---> 9b68f6f50482 Step 17/27 : COPY --chown=oracle:oracle fmw_12.2.1.3.0_wls_Disk1_1of1.zip wls.rsp /tmp/imagetool/ ---> 756751f052bc Step 18/27 : COPY --chown=oracle:oracle oraInst.loc /u01/oracle/ ---> c5fffb8b7130 Step 19/27 : USER oracle ---> Running in da51851dd83b Removing intermediate container da51851dd83b ---> 5f7b4a4340dc Step 20/27 : RUN echo "INSTALLING MIDDLEWARE" && echo "INSTALLING wls" && unzip -q /tmp/imagetool/fmw_12.2.1.3.0_wls_Disk1_1of1.zip "*.[jb][ai][rn]" -d /tmp/imagetool && /u01/jdk/bin/java -Xmx1024m -jar /tmp/imagetool/fmw_12.2.1.3.0_wls.jar -silent ORACLE_HOME=/u01/oracle -responseFile /tmp/imagetool/wls.rsp -invPtrLoc /u01/oracle/oraInst.loc -ignoreSysPrereqs -force -novalidation && test $? -eq 0 && chmod -R g+r /u01/oracle || (grep -vh "NOTIFICATION" /tmp/OraInstall*/install*.log && exit 1) ---> Running in 3bcf20f93b2d INSTALLING MIDDLEWARE INSTALLING wls Launcher log file is /tmp/OraInstall2022-08-01_12-10-26PM/launcher2022-08-01_12-10-26PM.log. Extracting the installer . . . . . Done Checking if CPU speed is above 300 MHz. Actual 2445.406 MHz Passed Checking swap space: must be greater than 512 MB. Actual 8191 MB Passed Checking if this platform requires a 64-bit JVM. Actual 64 Passed (64-bit not required) Checking temp space: must be greater than 300 MB. Actual 12190 MB Passed Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2022-08-01_12-10-26PM Log: /tmp/OraInstall2022-08-01_12-10-26PM/install2022-08-01_12-10-26PM.log Setting ORACLE_HOME to /u01/oracle Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. Reading response file.. Skipping Software Updates Validations are disabled for this session. Verifying data Copying Files Percent Complete : 10 Percent Complete : 20 Percent Complete : 30 Percent Complete : 40 Percent Complete : 50 Percent Complete : 60 Percent Complete : 70 Percent Complete : 80 Percent Complete : 90 Percent Complete : 100 The installation of Oracle Fusion Middleware 12c WebLogic Server and Coherence 12.2.1.3.0 completed successfully. Logs successfully copied to /u01/oracle/oraInventory/logs. Removing intermediate container 3bcf20f93b2d ---> 8857fe7f39ce Step 21/27 : FROM os_update as final_build ---> fcccf2392b0a Step 22/27 : ENV ORACLE_HOME=/u01/oracle JAVA_HOME=/u01/jdk PATH=${PATH}:/u01/jdk/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle ---> Running in e560753ced7f Removing intermediate container e560753ced7f ---> 39ea94312cb5 Step 23/27 : LABEL com.oracle.weblogic.imagetool.buildid="51c8ba6b-30e9-4302-a018-a1513f41dafb" ---> Running in 64daa5b0bc1f Removing intermediate container 64daa5b0bc1f ---> f91b13866c7b Step 24/27 : COPY --from=jdk_build --chown=oracle:oracle /u01/jdk /u01/jdk/ ---> c0f735c6d8c5 Step 25/27 : COPY --from=wls_build --chown=oracle:oracle /u01/oracle /u01/oracle/ ---> ded8b1c9df84 Step 26/27 : USER oracle ---> Running in b02e8b04b86f Removing intermediate container b02e8b04b86f ---> 95d620956ed0 Step 27/27 : WORKDIR /u01/oracle ---> Running in 9d44aca8532c Removing intermediate container 9d44aca8532c ---> d4374a78436c Successfully built d4374a78436c Successfully tagged wls:12.2.1.3.0 [INFO ] Build successful. Build time=393s. Image tag=wls:12.2.1.3.0 [root@middleware-works-centos8 bin]# docker image list REPOSITORY TAG IMAGE ID CREATED SIZE wls 12.2.1.3.0 d4374a78436c 55 minutes ago 1.36GB ghcr.io/oracle/oraclelinux 8-slim c7c0b3ae3077 3 weeks ago 101MB
이미지 생성이 완료되었습니다.
docker image list 명령으로 정상적으로 docker image가 생성 된 것을 확인 해 볼 수 있습니다.
docker 파일 실행 및 쿠버네티스 등을 활용하여 사용하시면 됩니다.
다음에는 Docker Image생성 응용 및 운영환경 구성에 대해 알아보도록 하겠습니다.