Integrating Critical Patch Updates (CPU) into your WebLogic Server on Docker

Posted by Dirk Nachbar on Tuesday, August 30, 2016
Bruno Borges is doing a great job providing Docker Images for various Oracle WebLogic scenarios within the GitHub Repository https://github.com/oracle/docker-images/tree/master/OracleWebLogic

The provided samples are a real good starting point to create your Oracle WebLogic Servers and Domains including sample application.

But I personally miss one point within the Installation process of the Oracle WebLogic Server, applying Critical Patch Updates.

The integration is really simple.
As an example I will take Bruno's build file https://github.com/oracle/docker-images/blob/master/OracleWebLogic/dockerfiles/12.2.1/Dockerfile.generic for the installation of the WebLogic Server 12.2.1 Generic Version and extend the Dockerfile with an apply of the Critical Patch Update July 2016 for Oracle WebLogic Server 12.2.1.0.0 (Patch No. 23094285).

As pre requirement download all the mentioned Software Files within Bruno's GitHub Repository and in addition download from My Oracle Support the Patch No. 23094285 (file name: p23094285_122100_Generic.zip) and place them into the dockerfiles/12.2.1 directory on your server.

As next modify the Dockerfile.generic as follows, see line no. 5 - Environment for CPUJuly2016 Patch Number


# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV FMW_PKG=fmw_12.2.1.0.0_wls_Disk1_1of1.zip \
    FMW_JAR=fmw_12.2.1.0.0_wls.jar \
    CPUJULY2016=p23094285_122100_Generic.zip \
    ORACLE_HOME=/u01/oracle \
    USER_MEM_ARGS="-Djava.security.egd=file:/dev/./urandom" \
    PATH=$PATH:/usr/java/default/bin:/u01/oracle/oracle_common/common/bin

see line no. 4 - for copy of CPUJuly2016 file
# Copy packages
# -------------
COPY $FMW_PKG install.file oraInst.loc /u01/
COPY $CPUJULY2016 /u01/

see lines no. 8, 9 and 14 for the adjusting of the chown command. see lines no 12 and 13 for the extraction and apply of the CPUJuly2016 Patch see line no. 15 for the cleanup of the CPUJuly2016 file
# Setup filesystem and oracle user
# Install and configure Oracle JDK
# Adjust file permissions, go to /u01 as user 'oracle' to proceed with WLS installation
# ------------------------------------------------------------
RUN chmod a+xr /u01 && \
    useradd -b /u01 -m -s /bin/bash oracle && \
    echo oracle:oracle | chpasswd && \
    # Move chown command to an upper position in order to avoid permission problems while applying CPU patch
    chown oracle:oracle -R /u01 && \
    cd /u01 && $JAVA_HOME/bin/jar xf /u01/$FMW_PKG && cd - && \
    su -c "$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\"" - oracle && \
    su -c "cd /u01 && /u01/oracle/oracle_common/adr/unzip $CPUJULY2016" - oracle && \
    su -c "cd /u01/23094285 && /u01/oracle/OPatch/opatch apply -silent" - oracle && \
    # chown oracle:oracle -R /u01 && \
    rm /u01/$FMW_JAR /u01/$FMW_PKG /u01/$CPUJULY2016 /u01/oraInst.loc /u01/install.file

Before you start with the build process, make sure that you have all mentioned pre requirements from Bruno, e.g. the oracle/jdk:8 image.

[root@server] docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
oracle/jdk          8                   1fe717b7315d        15 minutes ago      520.1 MB

The next step will be to create your Oracle WebLogic Server Image, which now will include the current available Critical Patch Update, you should see during your build process following output:


Sending build context to Docker daemon 882.4 MB
Step 1 : FROM oracle/jdk:8
 ---> 1fe717b7315d
. . .
. . .
Oracle Interim Patch Installer version 13.3.0.0.0
Copyright (c) 2016, Oracle Corporation.  All rights reserved.

Oracle Home       : /u01/oracle
Central Inventory : /u01/oracle/.inventory
   from           : /u01/oracle/oraInst.loc
OPatch version    : 13.3.0.0.0
OUI version       : 13.3.0.0.0
Log file location : /u01/oracle/cfgtoollogs/opatch/23094285_Aug_30_2016_11_04_46/apply2016-08-30_11-04-43AM_1.log

OPatch detects the Middleware Home as "/u01/oracle"

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   23094285  

Do you want to proceed? [y|n]
Y (auto-answered by -silent)
User Responded with: Y
All checks passed.
. . . 
. . .
OPatch succeeded.
. . .

And now you got an Oracle WebLogic Server Image including the latest available Critical Patch Update :-)
But keep in mind, for future CPU's you might also include before the opatch apply step an update of the opatch utility, as from time to time Oracle requires a newer version of the opatch utility.