Updating WebLogic Images using Oracle WebLogic Image Tool

Posted by Dirk Nachbar on Monday, June 24, 2019
On 21st June 2019 I was showing in a blog post the Oracle WebLogic Image Tool and how to create Oracle WebLogic Images on Docker with the Oracle WebLogic Image Tool https://dirknachbar.blogspot.com/2019/06/oracle-weblogic-image-tool.html


Today, I will show how to update an existing Oracle WebLogic Image on Docker with the Oracle WebLogic Image Tool https://github.com/oracle/weblogic-image-tool

Let's assume, I have one Oracle WebLogic 12.2.1.3.0 Docker Image named oracle/wls_serverjre:1.0 and I want to apply the Patch 29637821 and tag the Image as oracle/wls_serverjre:2.0

#
$ docker images | grep oracle/wls_serverjre
oracle/wls_serverjre   1.0                        ca40e90b620f        3 hours ago         1.22GB

# Lets get into the oracle/wls_serverjre:1.0 Image
# and check which Patches are already applied

$ docker run --rm -it oracle/wls_serverjre:1.0 /bin/bash

[oracle@c629e274ef67 oracle]$ cd OPatch/
[oracle@c629e274ef67 OPatch]$ ./opatch lsinventory
Oracle Interim Patch Installer version 13.9.4.2.0
Copyright (c) 2019, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/oracle
Central Inventory : /u01/oracle/oraInventory
   from           : /u01/oracle/oraInst.loc
OPatch version    : 13.9.4.2.0
OUI version       : 13.9.4.0.0
Log file location : /u01/oracle/cfgtoollogs/opatch/opatch2019-06-24_10-28-39AM_1.log


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

Lsinventory Output file location : /u01/oracle/cfgtoollogs/opatch/lsinv/lsinventory2019-06-24_10-28-39AM.txt

--------------------------------------------------------------------------------
Local Machine Information::
Hostname: c629e274ef67
ARU platform id: 226
ARU platform description:: Linux x86-64


Interim patches (5) :

Patch  29016089     : applied on Mon Jun 24 08:02:18 GMT 2019
Unique Patch ID:  22640288
Patch description:  "WLS PATCH SET UPDATE 12.2.1.3.190416"
   Created on 31 Jan 2019, 00:50:49 hrs PST8PDT
   Bugs fixed:
     23076695, 23103220, 25387569, 25488428, 25580220, 25665727, 25750303
     25800186, 25987400, 25993295, 26026959, 26080417, 26098043, 26144830
     26145911, 26248394, 26267487, 26268190, 26353793, 26439373, 26473149
     26499391, 26502060, 26547016, 26589850, 26608537, 26624375, 26626528
     26731253, 26791760, 26806438, 26828499, 26835012, 26929163, 26936500
     26943614, 26985581, 27033250, 27055227, 27086845, 27111664, 27117282
     27118731, 27131483, 27187631, 27213775, 27234961, 27272911, 27284496
     27397287, 27411153, 27417245, 27445260, 27469756, 27486993, 27516977
     27561226, 27603087, 27617877, 27693510, 27803728, 27819370, 27912485
     27927071, 27928833, 27934864, 27947832, 27948303, 27988175, 28071913
     28103938, 28110087, 28138954, 28140800, 28142116, 28149607, 28166483
     28171852, 28172380, 28311332, 28313163, 28319690, 28360225, 28375173
     28375702, 28409586, 28503638, 28550962, 28559579, 28594324, 28626991
     28632521, 28651365, 28748179, 28774974, 28874066, 28891448, 28895280
     28958819, 28984617, 29140508, 29140516, 29140540, 29140549, 29140551
     29140555

Patch  26355633     : applied on Mon Jun 24 08:00:52 GMT 2019
Unique Patch ID:  21447583
Patch description:  "One-off"
   Created on 1 Aug 2017, 21:40:20 hrs UTC
   Bugs fixed:
     26355633

Patch  26287183     : applied on Mon Jun 24 08:00:43 GMT 2019
Unique Patch ID:  21447582
Patch description:  "One-off"
   Created on 1 Aug 2017, 21:41:27 hrs UTC
   Bugs fixed:
     26287183

Patch  26261906     : applied on Mon Jun 24 08:00:29 GMT 2019
Unique Patch ID:  21344506
Patch description:  "One-off"
   Created on 12 Jun 2017, 23:36:08 hrs UTC
   Bugs fixed:
     25559137, 25232931, 24811916

Patch  26051289     : applied on Mon Jun 24 08:00:25 GMT 2019
Unique Patch ID:  21455037
Patch description:  "One-off"
   Created on 31 Jul 2017, 22:11:57 hrs UTC
   Bugs fixed:
     26051289



--------------------------------------------------------------------------------

OPatch succeeded.
[oracle@c629e274ef67 OPatch]$ exit

As you can see from the above displayed opatch lsinventory, on the oracle/wls_serverjre:1.0 are just the 4 Patches which are applied during the base software installation and the latest PSU 29016089 from April 2019.

Now let's start to update the Docker Image oracle/wls_serverjre:1.0 and apply the Patch 29637821

#
$ imagetool update \
          --fromImage oracle/wls_serverjre:1.0 \
          --tag oracle/wls_serverjre:2.0 \
          --user <Your MyOracleSupport UserAccount> \
          --password=<Your MyOracleSupport Password> \
          --patches p29637821
[2019-06-24 12:31:42] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] tmp directory in for docker run: /home/din/wlsimgbuilder_temp3197293039367443425 
[2019-06-24 12:31:50] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] ID="ol" 
[2019-06-24 12:31:50] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] OPATCH_VERSION=13.9.4.2.0 
[2019-06-24 12:31:50] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] WLS_VERSION=12.2.1.3.0 
[2019-06-24 12:31:50] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] ORACLE_HOME=/u01/oracle 
[2019-06-24 12:31:50] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] VERSION_ID="7.6" 
[2019-06-24 12:31:50] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] opatch-lsinventory file exists at: /home/din/wlsimgbuilder_temp3197293039367443425/opatch-lsinventory.txt 
[Fatal Error] :11:11: Open quote is expected for attribute "rel" associated with an  element type  "link".
[2019-06-24 12:32:23] [com.oracle.weblogic.imagetool.cli.CLIDriver] [SEVERE ] Response code: -1, message: Malformed XML document 

First trial => FAILED ! Unfortunately the documentation is is a bit confusing on this section, it just states that sometimes you have to use p[nnnnnnnn] and sometimes just the PatchNumber without the starting "p".  So in case you receive above shown error, just try it without the leading "p" and use just the plain PatchNumber.

#
$ imagetool update \
          --fromImage oracle/wls_serverjre:1.0 \
          --tag oracle/wls_serverjre:2.0 \
          --user <Your MyOracleSupport UserAccount> \
          --password=<Your MyOracleSupport Password> \
          --patches 29637821

[2019-06-24 12:34:38] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] tmp directory in for docker run: /home/din/wlsimgbuilder_temp402222832861943526 
[2019-06-24 12:34:46] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] ID="ol" 
[2019-06-24 12:34:46] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] OPATCH_VERSION=13.9.4.2.0 
[2019-06-24 12:34:46] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] WLS_VERSION=12.2.1.3.0 
[2019-06-24 12:34:46] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] ORACLE_HOME=/u01/oracle 
[2019-06-24 12:34:46] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] VERSION_ID="7.6" 
[2019-06-24 12:34:46] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] opatch-lsinventory file exists at: /home/din/wlsimgbuilder_temp402222832861943526/opatch-lsinventory.txt 
[2019-06-24 12:35:17] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] patch conflict check successful 
[2019-06-24 12:35:26] [com.oracle.weblogic.imagetool.cli.menu.UpdateImage] [INFO   ] docker cmd = docker build --force-rm=true --no-cache --tag oracle/wls_serverjre:2.0 --build-arg BASE_IMAGE=oracle/wls_serverjre:1.0 --build-arg PATCHDIR=patches /home/din/wlsimgbuilder_temp6168038296324443485 
Sending build context to Docker daemon  22.53kB
. . . 
. . .
Backup area for restore has been cleaned up. For a complete list of files/directories
deleted, Please refer log file.

OPatch succeeded.
Removing intermediate container d47fbeb76474
 ---> 1556d1cd3aa7
Successfully built 1556d1cd3aa7
Successfully tagged oracle/wls_serverjre:2.0

Now, we can check if the new Docker Image was build correctly and if the Patch 29637821 was correctly applied on the new Image.

#
$ docker images | grep oracle/wls_serverjre
oracle/wls_serverjre   2.0                        1556d1cd3aa7        2 minutes ago      1.22GB
oracle/wls_serverjre   1.0                        ca40e90b620f        3 hours ago         1.22GB

$ docker run --rm -it oracle/wls_serverjre:2.0 /bin/bash

[oracle@7170ca6878ab oracle]$ cd OPatch/
[oracle@7170ca6878ab OPatch]$ ./opatch lsinventory
Oracle Interim Patch Installer version 13.9.4.2.0
Copyright (c) 2019, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/oracle
Central Inventory : /u01/oracle/oraInventory
   from           : /u01/oracle/oraInst.loc
OPatch version    : 13.9.4.2.0
OUI version       : 13.9.4.0.0
Log file location : /u01/oracle/cfgtoollogs/opatch/opatch2019-06-24_10-36-41AM_1.log


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

Lsinventory Output file location : /u01/oracle/cfgtoollogs/opatch/lsinv/lsinventory2019-06-24_10-36-41AM.txt

--------------------------------------------------------------------------------
Local Machine Information::
Hostname: 7170ca6878ab
ARU platform id: 226
ARU platform description:: Linux x86-64


Interim patches (6) :

Patch  29637821     : applied on Mon Jun 24 10:35:39 GMT 2019
Unique Patch ID:  22888395
Patch description:  "One-off"
   Created on 24 Apr 2019, 22:39:34 hrs PST8PDT
   Bugs fixed:
     29637821

Patch  29016089     : applied on Mon Jun 24 08:02:18 GMT 2019
Unique Patch ID:  22640288
Patch description:  "WLS PATCH SET UPDATE 12.2.1.3.190416"
   Created on 31 Jan 2019, 00:50:49 hrs PST8PDT
   Bugs fixed:
     23076695, 23103220, 25387569, 25488428, 25580220, 25665727, 25750303
     25800186, 25987400, 25993295, 26026959, 26080417, 26098043, 26144830
     26145911, 26248394, 26267487, 26268190, 26353793, 26439373, 26473149
     26499391, 26502060, 26547016, 26589850, 26608537, 26624375, 26626528
     26731253, 26791760, 26806438, 26828499, 26835012, 26929163, 26936500
     26943614, 26985581, 27033250, 27055227, 27086845, 27111664, 27117282
     27118731, 27131483, 27187631, 27213775, 27234961, 27272911, 27284496
     27397287, 27411153, 27417245, 27445260, 27469756, 27486993, 27516977
     27561226, 27603087, 27617877, 27693510, 27803728, 27819370, 27912485
     27927071, 27928833, 27934864, 27947832, 27948303, 27988175, 28071913
     28103938, 28110087, 28138954, 28140800, 28142116, 28149607, 28166483
     28171852, 28172380, 28311332, 28313163, 28319690, 28360225, 28375173
     28375702, 28409586, 28503638, 28550962, 28559579, 28594324, 28626991
     28632521, 28651365, 28748179, 28774974, 28874066, 28891448, 28895280
     28958819, 28984617, 29140508, 29140516, 29140540, 29140549, 29140551
     29140555

Patch  26355633     : applied on Mon Jun 24 08:00:52 GMT 2019
Unique Patch ID:  21447583
Patch description:  "One-off"
   Created on 1 Aug 2017, 21:40:20 hrs UTC
   Bugs fixed:
     26355633

Patch  26287183     : applied on Mon Jun 24 08:00:43 GMT 2019
Unique Patch ID:  21447582
Patch description:  "One-off"
   Created on 1 Aug 2017, 21:41:27 hrs UTC
   Bugs fixed:
     26287183

Patch  26261906     : applied on Mon Jun 24 08:00:29 GMT 2019
Unique Patch ID:  21344506
Patch description:  "One-off"
   Created on 12 Jun 2017, 23:36:08 hrs UTC
   Bugs fixed:
     25559137, 25232931, 24811916

Patch  26051289     : applied on Mon Jun 24 08:00:25 GMT 2019
Unique Patch ID:  21455037
Patch description:  "One-off"
   Created on 31 Jul 2017, 22:11:57 hrs UTC
   Bugs fixed:
     26051289



--------------------------------------------------------------------------------

OPatch succeeded.

You can see, that the new WebLogic Server Image oracle/wls_serverjre:2.0 was correctly build and the Patch 29637821 was applied correctly to the new Image. The only minor problem is the handling of the Patch Number with the Oracle WebLogic Image Tool, if Oracle can with a unique approach how to pass the Patches (either with leading "p" or without), the tool becomes really useful.