This is using official Oracle Docker image repo
For own Centos 8 images see https://danielveselka.blogspot.com/2021/02/create-centos-8-oracle-jdk-docker-image.html
Clone Oracle Docker image repo
https://github.com/oracle/docker-images/tree/master/OracleWebLogic
Alternatively download Weblogic image from Oracle Docker repository
https://container-registry.oracle.com/
https://www.middlewareinventory.com/blog/weblogic-docker/
See https://github.com/bzon/docker-oracle-weblogic for Docker compose sample
On Fedora 31+ modify Docker installation
https://fedoramagazine.org/docker-and-fedora-32/
Downloads
- Download Oracle JDK 8 server-jre-8u261-linux-x64.tar.gz for Docker image https://www.oracle.com/in/java/technologies/javase-downloads.html
- Download Weblogic server image http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html
Build Oracle JDK 8 Docker image
Build Weblogic Server image
./buildDockerImage.sh -hUsage: buildDockerImage.sh -v [version] [-d | -g | -m ] [-j] [-s] [-c]
Builds a Docker Image for Oracle WebLogic.Parameters:
-v: version to build. Required.
Choose one of: 12.1.3 12.2.1.3 12.2.1.4 14.1.1.0
-d: creates image based on 'developer' distribution
-g: creates image based on 'generic' distribution
-j: choose '8' to create a 14.1.1.0 image with JDK 8 or '11' to create a 14.1.1.0 image with JDK 11.
-m: creates image based on 'slim' distribution
-c: enables Docker image layer cache during build
-s: skips the MD5 check of packages* select one distribution only: -d, -g, or -mLICENSE UPL 1.0Copyright (c) 2014, 2020, Oracle and/or its affiliates.
./buildDockerImage.sh -v 12.2.1.4 -g
Set- WebLogic's Version 12.2.1.4
Set- Distribution:Generic
Version= 12.2.1.4 Distribution= generic
Checking if required packages are present and valid...
fmw_12.2.1.4.0_wls_lite_Disk1_1of1.zip: OK
md5sum: WARNING: 1 line is improperly formatted
=====================
Proxy settings were found and will be used during build.
Building image 'oracle/weblogic:12.2.1.4-generic' ...
Building image using Dockerfile.'generic'
Sending build context to Docker daemon 607.2MB
Step 1/19 : FROM oracle/serverjre:8 as builder
---> b12cce0cdc47
Step 2/19 : LABEL "provider"="Oracle" "maintainer"="Monica Riccelli <monica.riccelli@oracle.com>" "issues"="https://github.com/oracle/docker-images/issues" "port.admin.listen"="7001" "port.administration"="9002"
---> Running in f8d99a88a5ad
Removing intermediate container f8d99a88a5ad
---> d736736d476b
Step 3/19 : ENV ORACLE_HOME=/u01/oracle USER_MEM_ARGS="-Djava.security.egd=file:/dev/./urandom" PATH=$PATH:${JAVA_HOME}/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin
---> Running in 3f2ececaf11a
Removing intermediate container 3f2ececaf11a
---> 146b8fcd883b
Step 4/19 : RUN mkdir /u01 && useradd -b /u01 -d /u01/oracle -m -s /bin/bash oracle && chown oracle:root -R /u01 && chmod -R 775 /u01
---> Running in b0d432006afd
Removing intermediate container b0d432006afd
---> cf3b48c68fd8
Step 5/19 : ENV FMW_PKG=fmw_12.2.1.4.0_wls_lite_Disk1_1of1.zip FMW_JAR=fmw_12.2.1.4.0_wls_lite_generic.jar
---> Running in cef80193cca1
Removing intermediate container cef80193cca1
---> 61d8ae7b497c
Step 6/19 : COPY --chown=oracle:root $FMW_PKG install.file oraInst.loc /u01/
---> 54d99177fc67
Step 7/19 : USER oracle
---> Running in 93ef6bacad54
Removing intermediate container 93ef6bacad54
---> 97b07f62eaf0
Step 8/19 : RUN cd /u01 && ${JAVA_HOME}/bin/jar xf /u01/$FMW_PKG && cd - && ${JAVA_HOME}/bin/java -jar /u01/$FMW_JAR -silent -responseFile /u01/install.file -invPtrLoc /u01/oraInst.loc -jreLoc $JAVA_HOME -ignoreSysPrereqs -force -novalidation ORACLE_HOME=$ORACLE_HOME INSTALL_TYPE="WebLogic Server" && rm /u01/$FMW_JAR /u01/$FMW_PKG /u01/install.file && rm -rf /u01/oracle/cfgtoollogs
---> Running in 2b8c2e927247
/
Launcher log file is /tmp/OraInstall2020-10-06_04-32-43PM/launcher2020-10-06_04-32-43PM.log.
Extracting the installer . . . . . . Done
Checking if CPU speed is above 300 MHz. Actual 2299.892 MHz Passed
Checking swap space: must be greater than 512 MB. Actual 0 MB Failed <<<<
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 35308 MB Passed>>> Ignoring failure(s) of required prerequisite checks and continuing.
Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2020-10-06_04-32-43PM
Log: /tmp/OraInstall2020-10-06_04-32-43PM/install2020-10-06_04-32-43PM.log
Setting ORACLE_HOME...
Setting INSTALL_TYPE...
Copyright (c) 1996, 2019, 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 : 100The installation of Oracle Fusion Middleware 12c WebLogic Server and Coherence 12.2.1.4.0 completed successfully.
Logs successfully copied to /u01/oracle/.inventory/logs.
Removing intermediate container 2b8c2e927247
---> d7a4e153f899
Step 9/19 : FROM oracle/serverjre:8
---> b12cce0cdc47
Step 10/19 : ENV ORACLE_HOME=/u01/oracle USER_MEM_ARGS="-Djava.security.egd=file:/dev/./urandom" SCRIPT_FILE=/u01/oracle/createAndStartEmptyDomain.sh HEALTH_SCRIPT_FILE=/u01/oracle/get_healthcheck_url.sh PATH=$PATH:${JAVA_HOME}/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin
---> Running in 431e04896ee9
Removing intermediate container 431e04896ee9
---> eb2f7f4b28c6
Step 11/19 : ENV DOMAIN_NAME="${DOMAIN_NAME:-base_domain}" ADMIN_LISTEN_PORT="${ADMIN_LISTEN_PORT:-7001}" ADMIN_NAME="${ADMIN_NAME:-AdminServer}" ADMINISTRATION_PORT_ENABLED="${ADMINISTRATION_PORT_ENABLED:-true}" ADMINISTRATION_PORT="${ADMINISTRATION_PORT:-9002}"
---> Running in 63039f801c73
Removing intermediate container 63039f801c73
---> 81f866830975
Step 12/19 : RUN mkdir -p /u01 && chmod 775 /u01 && useradd -b /u01 -d /u01/oracle -m -s /bin/bash oracle && chown oracle:root /u01
---> Running in 0d343b7ba4a1
Removing intermediate container 0d343b7ba4a1
---> 313342ac76f6
Step 13/19 : COPY --from=builder --chown=oracle:root /u01 /u01
---> 78f69917697e
Step 14/19 : COPY container-scripts/createAndStartEmptyDomain.sh container-scripts/create-wls-domain.py container-scripts/get_healthcheck_url.sh /u01/oracle/
---> 50da8dbcf889
Step 15/19 : RUN chmod +xr $SCRIPT_FILE $HEALTH_SCRIPT_FILE && chown oracle:root $SCRIPT_FILE /u01/oracle/create-wls-domain.py $HEALTH_SCRIPT_FILE
---> Running in d99c49d10e81
Removing intermediate container d99c49d10e81
---> d92ddd8d7375
Step 16/19 : USER oracle
---> Running in 453e1dfee2ef
Removing intermediate container 453e1dfee2ef
---> 1d89d8a52ac8
Step 17/19 : HEALTHCHECK --start-period=10s --timeout=30s --retries=3 CMD curl -k -s --fail `$HEALTH_SCRIPT_FILE` || exit 1
---> Running in 57809c715f24
Removing intermediate container 57809c715f24
---> 209494bd4b6c
Step 18/19 : WORKDIR ${ORACLE_HOME}
---> Running in a82dc96b8ddc
Removing intermediate container a82dc96b8ddc
---> 8ab075250e2f
Step 19/19 : CMD ["/u01/oracle/createAndStartEmptyDomain.sh"]
---> Running in 3a8437f5ed11
Removing intermediate container 3a8437f5ed11
---> 9dd72f2c0bc0
Successfully built 9dd72f2c0bc0
Successfully tagged oracle/weblogic:12.2.1.4-generic WebLogic Docker Image for 'generic' version 12.2.1.4 is ready to be extended: --> oracle/weblogic:12.2.1.4-generic Build completed in 121 seconds.
Build domain
[centos@dave 12213-domain]$ more ./build.sh
#! /bin/bash
#
#Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
#
#Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
#
#Build WebLogic Domain image persisted to volumedocker build -f Dockerfile -t 12213-weblogic-domain-in-volume .
[centos@dave 12213-domain]$ vi Dockerfile
[centos@dave 12213-domain]$ ./build.sh
Sending build context to Docker daemon 37.89kB
Step 1/11 : FROM oracle/weblogic:12.2.1.4-generic
---> 4ce73a139125
Step 2/11 : LABEL "provider"="Oracle" "maintainer"="Monica Riccelli <monica.riccelli@oracle.com>" "issues"="https://github.com/oracle/docker-images/issues" "port.admin.listen"="7001" "port.administration"="9002" "port.managed.server"="8001"
---> Running in c835f39122df
Removing intermediate container c835f39122df
---> b9c89cbdf500
Step 3/11 : ENV DOMAIN_ROOT="/u01/oracle/user_projects/domains" ADMIN_HOST="${ADMIN_HOST:-AdminContainer}" MANAGED_SERVER_PORT="${MANAGED_SERVER_PORT:-8001}" MANAGED_SERVER_NAME_BASE="${MANAGED_SERVER_NAME_BASE:-MS}" MANAGED_SERVER_CONTAINER="${MANAGED_SERVER_CONTAINER:-false}" CONFIGURED_MANAGED_SERVER_COUNT="${CONFIGURED_MANAGED_SERVER_COUNT:-2}" MANAGED_NAME="${MANAGED_NAME:-MS1}" CLUSTER_NAME="${CLUSTER_NAME:-cluster1}" CLUSTER_TYPE="${CLUSTER_TYPE:-DYNAMIC}" PROPERTIES_FILE_DIR="/u01/oracle/properties" JAVA_OPTIONS="-Doracle.jdbc.fanEnabled=false -Dweblogic.StdoutDebugEnabled=false" PATH="$PATH:${JAVA_HOME}/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle/container-scripts"
---> Running in 84b5fc5ce774
Removing intermediate container 84b5fc5ce774
---> 522568b73d0f
Step 4/11 : COPY --chown=oracle:oracle container-scripts/* /u01/oracle/container-scripts/
---> 46366a86c0a3
Step 5/11 : COPY --chown=oracle:oracle container-scripts/get_healthcheck_url.sh /u01/oracle/get_healthcheck_url.sh
---> de84286612b9
Step 6/11 : USER root
---> Running in 378af82336af
Removing intermediate container 378af82336af
---> 1e46b9768728
Step 7/11 : RUN mkdir -p $DOMAIN_ROOT && chown -R oracle:oracle $DOMAIN_ROOT/.. && chmod -R a+xwr $DOMAIN_ROOT/.. && mkdir -p $ORACLE_HOME/properties && chmod -R a+r $ORACLE_HOME/properties && chmod +x /u01/oracle/container-scripts/*
---> Running in 9eaa3b52ebc4
Removing intermediate container 9eaa3b52ebc4
---> 1547b3da749e
Step 8/11 : VOLUME $DOMAIN_ROOT
---> Running in 23f2f75bf138
Removing intermediate container 23f2f75bf138
---> 0ba76fec1693
Step 9/11 : USER oracle
---> Running in dcb7192cd277
Removing intermediate container dcb7192cd277
---> 7b9bdaa230d9
Step 10/11 : WORKDIR $ORACLE_HOME
---> Running in 1fdfd3c2a584
Removing intermediate container 1fdfd3c2a584
---> 5dd674f9a68b
Step 11/11 : CMD ["/u01/oracle/container-scripts/createWLSDomain.sh"]
---> Running in f03451d26803
Removing intermediate container f03451d26803
---> 29cc97f25353
Successfully built 29cc97f25353
Successfully tagged 12213-weblogic-domain-in-volume:latest
Start Admin server
./run_admin_server.sh
Context for docker build is /git/docker-images/OracleWebLogic/samples/12213-domain
Export environment variables from the /git/docker-images/OracleWebLogic/samples/12213-domain/properties/domain.properties properties file
env_arg: DOMAIN_NAME=myDomain
env_arg: ADMIN_NAME=myadmin
env_arg: ADMIN_LISTEN_PORT=7001
env_arg: ADMIN_HOST=AdminContainer
env_arg: ADMINISTRATION_PORT_ENABLED=false
env_arg: ADMINISTRATION_PORT=9002
env_arg: MANAGED_SERVER_PORT=8001
env_arg: MANAGED_SERVER_NAME_BASE=MS
env_arg: CONFIGURED_MANAGED_SERVER_COUNT=2
env_arg: CLUSTER_NAME=cluster1
env_arg: CLUSTER_TYPE=DYNAMIC
env_arg: PRODUCTION_MODE=dev
env_arg: DOMAIN_HOST_VOLUME=/app/domains
The domain configuration will get persisted in the host volume: /app/domains
administrationport=9002
docker run -d -p 9001:7001 -p 9002:9002 --name AdminContainer --hostname AdminContainer -v /git/docker-images/OracleWebLogic/samples/12213-domain/properties:/u01/oracle/properties -v /app/domains:/u01/oracle/user_projects/domains -e DOMAIN_NAME=myDomain -e ADMIN_NAME=myadmin -e ADMIN_LISTEN_PORT=7001 -e ADMIN_HOST=AdminContainer -e ADMINISTRATION_PORT_ENABLED=false -e ADMINISTRATION_PORT=9002 -e MANAGED_SERVER_PORT=8001 -e MANAGED_SERVER_NAME_BASE=MS -e CONFIGURED_MANAGED_SERVER_COUNT=2 -e CLUSTER_NAME=cluster1 -e CLUSTER_TYPE=DYNAMIC -e PRODUCTION_MODE=dev 12213-weblogic-domain-in-volume
bb8e16947737ca93b174397ef47fb2427b4ea349ed0dad93c609172006ad842a
[centos@dave 12213-domain]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bb8e16947737 12213-weblogic-domain-in-volume "/u01/oracle/contain…" 5 seconds ago Up 4 seconds (health: starting) 0.0.0.0:9002->9002/tcp, 0.0.0.0:9001->7001/tcp AdminContainer
On Fedora with SE Linux add :z to mounted host volume to allow access for container
https://www.reddit.com/r/Fedora/comments/g38e3g/docker_volume_mount_permission_denied/
https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label
Without this there is error because mounted host volume with password files is not accessible for container.
A properties file with the username and password needs to be supplied.
[dave@dave 12.2.1.4]$ docker run -d -p 7001:7001 -p 9002:9002 -v /app/domains/properties:/u01/oracle/properties:z -e ADMINISTRATION_PORT_ENABLED=true -e DOMAIN_NAME=docker_domain oracle/weblogic:12.2.1.4-generic
145f8e92131287cc11c58c310724bd416173c64f4b605da3863e2cd80aee354a
[dave@dave 12.2.1.4]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
145f8e921312 oracle/weblogic:12.2.1.4-generic "/u01/oracle/createA…" 3 seconds ago Up 2 seconds (health: starting) 0.0.0.0:7001->7001/tcp, 0.0.0.0:9002->9002/tcp vigilant_gould
No comments:
Post a Comment