Create or update an image

As described in Prepare Your Environment you can create your own OUDSM container image. If you have access to the My Oracle Support (MOS), and there is a need to build a new image with an interim or one off patch, it is recommended to use the WebLogic Image Tool to build an Oracle Unified Directory image for production deployments.

Create or update an Oracle Unified Directory Services Manager image using the WebLogic Image Tool

Using the WebLogic Image Tool, you can create a new Oracle Unified Directory Services Manager image with PSU’s and interim patches or update an existing image with one or more interim patches.

Recommendations:

  • Use create for creating a new Oracle Unified Directory Services Manager image containing the Oracle Unified Directory Services Manager binaries, bundle patch and interim patches. This is the recommended approach if you have access to the OUDSM patches because it optimizes the size of the image.
  • Use update for patching an existing Oracle Unified Directory Services Manager image with a single interim patch. Note that the patched image size may increase considerably due to additional image layers introduced by the patch application tool.

Create an image

Set up the WebLogic Image Tool

Prerequisites

Verify that your environment meets the following prerequisites:

  • Docker client and daemon on the build machine, with minimum Docker version 18.03.1.ce.
  • Bash version 4.0 or later, to enable the command complete feature.
  • JAVA_HOME environment variable set to the appropriate JDK location e.g: /scratch/export/oracle/product/jdk
Set up the WebLogic Image Tool

To set up the WebLogic Image Tool:

  1. Create a working directory and change to it:

    $ mdir <workdir>
    $ cd <workdir>
    

    For example:

    $ mkdir /scratch/imagetool-setup
    $ cd /scratch/imagetool-setup
    
  2. Download the latest version of the WebLogic Image Tool from the releases page.

    $ wget https://github.com/oracle/weblogic-image-tool/releases/download/release-X.X.X/imagetool.zip
    

    where X.X.X is the latest release referenced on the releases page.

  3. Unzip the release ZIP file in the imagetool-setup directory.

    $ unzip imagetool.zip
    
  4. Execute the following commands to set up the WebLogic Image Tool:

    $ cd <workdir>/imagetool-setup/imagetool/bin
    $ source setup.sh
    

    For example:

    $ cd /scratch/imagetool-setup/imagetool/bin
    $ source setup.sh
    
Validate setup

To validate the setup of the WebLogic Image Tool:

  1. Enter the following command to retrieve the version of the WebLogic Image Tool:

    $ imagetool --version
    
  2. Enter imagetool then press the Tab key to display the available imagetool commands:

    $ imagetool <TAB>
    cache   create  help    rebase  update
    
WebLogic Image Tool build directory

The WebLogic Image Tool creates a temporary Docker context directory, prefixed by wlsimgbuilder_temp, every time the tool runs. Under normal circumstances, this context directory will be deleted. However, if the process is aborted or the tool is unable to remove the directory, it is safe for you to delete it manually. By default, the WebLogic Image Tool creates the Docker context directory under the user’s home directory. If you prefer to use a different directory for the temporary context, set the environment variable WLSIMG_BLDDIR:

$ export WLSIMG_BLDDIR="/path/to/buid/dir"
WebLogic Image Tool cache

The WebLogic Image Tool maintains a local file cache store. This store is used to look up where the Java, WebLogic Server installers, and WebLogic Server patches reside in the local file system. By default, the cache store is located in the user’s $HOME/cache directory. Under this directory, the lookup information is stored in the .metadata file. All automatically downloaded patches also reside in this directory. You can change the default cache store location by setting the environment variable WLSIMG_CACHEDIR:

$ export WLSIMG_CACHEDIR="/path/to/cachedir"
Set up additional build scripts

Creating an Oracle Unified Directory Services Manager container image using the WebLogic Image Tool requires additional container scripts for Oracle Unified Directory Services Manager domains.

  1. Clone the docker-images repository to set up those scripts. In these steps, this directory is DOCKER_REPO:

    $ cd <workdir>/imagetool-setup
    $ git clone https://github.com/oracle/docker-images.git
    

    For example:

    $ cd /scratch/imagetool-setup
    $ git clone https://github.com/oracle/docker-images.git
    

Note: If you want to create the image continue with the following steps, otherwise to update the image see update an image.

Create an image

After setting up the WebLogic Image Tool, follow these steps to use the WebLogic Image Tool to create a new Oracle Unified Directory Services Manager image.

Download the Oracle Unified Directory Services Manager installation binaries and patches

You must download the required Oracle Unified Directory Services Manager installation binaries and patches as listed below from the Oracle Software Delivery Cloud and save them in a directory of your choice.

The installation binaries and patches required are:

  • Oracle Unified Directory 12.2.1.4.0

    • fmw_12.2.1.4.0_oud.jar
  • Oracle Fusion Middleware 12c Infrastructure 12.2.1.4.0

    • fmw_12.2.1.4.0_infrastructure.jar
  • OUDSM and FMW Infrastructure Patches:

    • View document ID 2723908.1 on My Oracle Support. In the Container Image Download/Patch Details section, locate the Oracle Unified Directory Services Manager (OUDSM) table. For the latest PSU click the README link in the Documentation column. In the README, locate the “Installed Software” section. All the patch numbers to be download are listed here. Download all these individual patches from My Oracle Support.
  • Oracle JDK v8

    • jdk-8uXXX-linux-x64.tar.gz where XXX is the JDK version referenced in the README above.
Update required build files

The following files in the code repository location <imagetool-setup-location>/docker-images/OracleUnifiedDirectorySM/imagetool/12.2.1.4.0 are used for creating the image:

  • additionalBuildCmds.txt
  • buildArgs
  1. Edit the <workdir>/imagetool-setup/docker-images/OracleUnifiedDirectorySM/imagetool/12.2.1.4.0/buildArgs file and change %DOCKER_REPO%,%JDK_VERSION% and %BUILDTAG% appropriately.

    For example:

    create
    --jdkVersion=8u321
    --type oud_wls
    --version=12.2.1.4.0
    --tag=oudsm-latestpsu:12.2.1.4.0
    --pull
    --installerResponseFile /scratch/imagetool-setup/docker-images/OracleFMWInfrastructure/dockerfiles/12.2.1.4/install.file,/scratch/imagetool-setup/docker-images/OracleUnifiedDirectorySM/dockerfiles/12.2.1.4.0/install/oud.response
    --additionalBuildCommands /scratch/imagetool-setup/docker-images/OracleUnifiedDirectorySM/imagetool/12.2.1.4.0/additionalBuildCmds.txt
    --additionalBuildFiles /scratch/imagetool-setup/docker-images/OracleUnifiedDirectorySM/dockerfiles/12.2.1.4.0/container-scripts
    
  2. The <workdir>/imagetool-setup/imagetool/docker-images/OracleUnifiedDirectorySM/imagetool/12.2.1.4.0/additionalBuildCmds.txt contains additional build commands. You may edit this file if you want to customize the image further.

  3. Edit the <workdir>/imagetool-setup/docker-images/OracleFMWInfrastructure/dockerfiles/12.2.1.4/install.file and under the GENERIC section add the line INSTALL_TYPE="Fusion Middleware Infrastructure”. For example:

    [GENERIC]
    INSTALL_TYPE="Fusion Middleware Infrastructure"
    DECLINE_SECURITY_UPDATES=true
    SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
    
Create the image
  1. Add a JDK package to the WebLogic Image Tool cache. For example:

    $ imagetool cache addInstaller --type jdk --version 8uXXX --path <download location>/jdk-8uXXX-linux-x64.tar.gz
    

    where XXX is the JDK version downloaded

  2. Add the downloaded installation binaries to the WebLogic Image Tool cache. For example:

    $ imagetool cache addInstaller --type OUD --version 12.2.1.4.0 --path <download location>/fmw_12.2.1.4.0_oud.jar
       
    $ imagetool cache addInstaller --type fmw --version 12.2.1.4.0 --path <download location>/fmw_12.2.1.4.0_infrastructure.jar
    
  3. Add the downloaded OPatch patch to the WebLogic Image Tool cache. For example:

    $ imagetool cache addEntry --key 28186730_13.9.4.2.8 --value <download location>/p28186730_139428_Generic.zip
    
  4. Add the rest of the downloaded product patches to the WebLogic Image Tool cache:

    $ imagetool cache addEntry --key <patch>_12.2.1.4.0 --value <download location>/p<patch>_122140_Generic.zip
    

    For example:

    $ imagetool cache addEntry --key 33727616_12.2.1.4.0 --value <download location>/p33727616_122140_Generic.zip
    $ imagetool cache addEntry --key 33093748_12.2.1.4.0 --value <download location>/p33093748_122140_Generic.zip
    $ imagetool cache addEntry --key 32720458_12.2.1.4.0 --value <download location>/p32720458_122140_Generic.zip
    $ imagetool cache addEntry --key 33791665_12.2.1.4.220105 --value <download location>/p33791665_12214220105_Generic.zip
    $ imagetool cache addEntry --key 33723124_12.2.1.4.0 --value <download location>/p33723124_122140_Generic.zip
    $ imagetool cache addEntry --key 32647448_12.2.1.4.0 --value <download location>/p32647448_122140_Linux-x86-64.zip
    $ imagetool cache addEntry --key 33591019_12.2.1.4.0 --value <download location>/p33591019_122140_Generic.zip
    $ imagetool cache addEntry --key 32999272_12.2.1.4.0 --value <download location>/p32999272_122140_Generic.zip
    $ imagetool cache addEntry --key 33448950_12.2.1.4.0 --value <download location>/p33448950_122140_Generic.zip
    $ imagetool cache addEntry --key 33697227_12.2.1.4.0 --value <download location>/p33697227_122140_Generic.zip
    $ imagetool cache addEntry --key 33678607_12.2.1.4.0 --value <download location>/p33678607_122140_Generic.zip
    $ imagetool cache addEntry --key 33735326_12.2.1.4.220105 --value <download location>/p33735326_12214220105_Generic.zip
    
  5. Edit the <workdir>/imagetool-setup/docker-images/OracleUnifiedDirectorySM/imagetool/12.2.1.4.0/buildArgs file and append the product patches and opatch patch as follows:

    --patches 33727616_12.2.1.4.0,33093748_12.2.1.4.0,32720458_12.2.1.4.0,33791665_12.2.1.4.220105,33723124_12.2.1.4.0,32647448_12.2.1.4.0,33591019_12.2.1.4.0,32999272_12.2.1.4.0,33448950_12.2.1.4.0,32999272_12.2.1.4.0,33448950_12.2.1.4.0,33697227_12.2.1.4.0,33678607_12.2.1.4.0,33735326_12.2.1.4.220105
    --opatchBugNumber=28186730_13.9.4.2.8
    

    An example buildArgs file is now as follows:

    create
    --jdkVersion=8u321
    --type oud_wls
    --version=12.2.1.4.0
    --tag=oudsm-latestpsu:12.2.1.4.0
    --pull
    --installerResponseFile /scratch/imagetool-setup/docker-images/OracleFMWInfrastructure/dockerfiles/12.2.1.4/install.file,/scratch/imagetool-setup/docker-images/OracleUnifiedDirectorySM/dockerfiles/12.2.1.4.0/install/oud.response
    --additionalBuildCommands /scratch/imagetool-setup/docker-images/OracleUnifiedDirectorySM/imagetool/12.2.1.4.0/additionalBuildCmds.txt
    --additionalBuildFiles /scratch/imagetool-setup/docker-images/OracleUnifiedDirectorySM/dockerfiles/12.2.1.4.0/container-scripts
    --patches 33727616_12.2.1.4.0,33093748_12.2.1.4.0,32720458_12.2.1.4.0,33791665_12.2.1.4.220105,33723124_12.2.1.4.0,32647448_12.2.1.4.0,33591019_12.2.1.4.0,32999272_12.2.1.4.0,33448950_12.2.1.4.0,33448950_12.2.1.4.0,33697227_12.2.1.4.0,33678607_12.2.1.4.0,33735326_12.2.1.4.220105
    --opatchBugNumber=28186730_13.9.4.2.8
    

    Note: In the buildArgs file:

    • --jdkVersion value must match the --version value used in the imagetool cache addInstaller command for --type jdk.
    • --version value must match the --version value used in the imagetool cache addInstaller command for --type OUDSM.

    Refer to this page for the complete list of options available with the WebLogic Image Tool create command.

  6. Create the Oracle Unified Directory Services Manager image:

    $ imagetool @<absolute path to buildargs file> --fromImage ghcr.io/oracle/oraclelinux:7-slim
    

    Note: Make sure that the absolute path to the buildargs file is prepended with a @ character, as shown in the example above.

    For example:

    $ imagetool @<imagetool-setup-location>/docker-images/OracleUnifiedDirectorySM/imagetool/12.2.1.4.0/buildArgs --fromImage ghcr.io/oracle/oraclelinux:7-slim
    
  7. Check the created image using the docker images command:

    $ docker images | grep oudsm
    

    The output will look similar to the following:

    oudsm-latestpsu                          12.2.1.4.0            f6dd9d2ca0e6        4 minutes ago       3.72GB
    
  8. Run the following command to save the container image to a tar file:

    $ docker save -o <path>/<file>.tar <image>
    

    For example:

    $ docker save -o $WORKDIR/oudsm-latestpsu.tar oudsm-latestpsu:12.2.1.4.0
    

Update an image

The steps below show how to update an existing Oracle Unified Directory Services Manager image with an interim patch.

The container image to be patched must be loaded in the local docker images repository before attempting these steps.

In the examples below the image oracle/oudsm:12.2.1.4.0 is updated with an interim patch.

$ docker images

REPOSITORY     TAG          IMAGE ID          CREATED             SIZE
oracle/oudsm   12.2.1.4.0   b051804ba15f      3 months ago        3.72GB
  1. Set up the WebLogic Image Tool.

  2. Download the required interim patch and latest Opatch (28186730) from My Oracle Support. and save them in a directory of your choice.

  3. Add the OPatch patch to the WebLogic Image Tool cache, for example:

    $ imagetool cache addEntry --key 28186730_13.9.4.2.8 --value <downloaded-patches-location>/p28186730_139428_Generic.zip
    
  4. Execute the imagetool cache addEntry command for each patch to add the required patch(es) to the WebLogic Image Tool cache. For example, to add patch p33521773_12214211008_Generic.zip:

    $ imagetool cache addEntry --key=33521773_12.2.1.4.211008 --value <downloaded-patches-location>/p33521773_12214211008_Generic.zip
    
  5. Provide the following arguments to the WebLogic Image Tool update command:

    • –-fromImage - Identify the image that needs to be updated. In the example below, the image to be updated is oracle/oudsm:12.2.1.4.0.
    • –-patches - Multiple patches can be specified as a comma-separated list.
    • --tag - Specify the new tag to be applied for the image being built.

    Refer here for the complete list of options available with the WebLogic Image Tool update command.

    Note: The WebLogic Image Tool cache should have the latest OPatch zip. The WebLogic Image Tool will update the OPatch if it is not already updated in the image.

    For example:

    $ imagetool update --fromImage oracle/oudsm:12.2.1.4.0 --tag=oracle/oudsm-new:12.2.1.4.0 --patches=33521773_12.2.1.4.211008 --opatchBugNumber=28186730_13.9.4.2.8
    

    Note: If the command fails because the files in the image being upgraded are not owned by oracle:oracle, then add the parameter --chown <userid>:<groupid> to correspond with the values returned in the error.

  6. Check the built image using the docker images command:

    $ docker images | grep oudsm
    

    The output will look similar to the following:

    REPOSITORY         TAG          IMAGE ID        CREATED             SIZE
    oracle/oudsm-new     12.2.1.4.0   78ccd1ad67eb    5 minutes ago       1.11GB
    oracle/oudsm         12.2.1.4.0   b051804ba15f    3 months ago        1.04GB
    
  7. Run the following command to save the patched container image to a tar file:

    $ docker save -o <path>/<file>.tar <image>
    

    For example:

    $ docker save -o $WORKDIR/oudsm-new.tar oracle/oudsm-new:12.2.1.4.0