Create or update an image

If you have access to the My Oracle Support (MOS), and there is a need to build a new image with a patch (bundle or interim), it is recommended to use the WebLogic Image Tool to build an Oracle WebCenter Sites image for production deployments.

Create or update an Oracle WebCenter Sites Docker image using the WebLogic Image Tool

Using the WebLogic Image Tool, you can create a new Oracle WebCenter Sites Docker image (can include patches as well) or update an existing image with one or more patches (bundle patch and interim patches).

Recommendations:

  • Use create for creating a new Oracle WebCenter Sites Docker image either:
    • without any patches
    • or, containing the Oracle WebCenter Sites binaries, bundle patch and interim patches. This is the recommended approach if you have access to the Oracle WebCenter Sites patches because it optimizes the size of the image.
  • Use update for patching an existing Oracle WebCenter Sites Docker 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.

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.
Set up the WebLogic Image Tool

To set up the WebLogic Image Tool:

  1. Create a working directory and change to it. In these steps, this directory is imagetool-setup.

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

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

  4. Execute the following commands to set up the WebLogic Image Tool on a Linux environment:

    $ cd 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 WebCenter Sites Docker image using the WebLogic Image Tool requires additional container scripts for Oracle WebCenter Sites domains.

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

    $ cd imagetool-setup
    $ git clone https://github.com/oracle/docker-images.git
    
  2. Copy the additional WebLogic Image Tool build files from the operator source repository to the imagetool-setup location:

    $ mkdir -p imagetool-setup/docker-images/OracleWebCenterSites/imagetool/12.2.1.4
    $ cd imagetool-setup/docker-images/OracleWebCenterSites/imagetool/12.2.1.4
    $ cp -rf ${WORKDIR}/fmw-kubernetes/OracleWebCenterSites/kubernetes/imagetool-scripts/* .
    

Create an image

After setting up the WebLogic Image Tool and required build scripts, follow these steps to use the WebLogic Image Tool to create a new Oracle WebCenter Sites Docker image.

Download the Oracle WebCenter Sites installation binaries and patches

You must download the required Oracle WebCenter Sites installation binaries and patches as listed below from the Oracle Software Delivery Cloud and save them in a directory of your choice. In these steps, this directory is download location.

Click here to see the sample list of installation binaries and patches:

Note: This is a sample list of patches. You must get the appropriate list of patches for your Oracle WebCenter Sites image.

Update required build files

The following files available in the code repository location ${WORKDIR}/fmw-kubernetes/OracleWebCenterSites/kubernetes/imagetool-scripts are used for creating the image.

  • additionalBuildCmds.txt
  • buildArgs
  1. In the buildArgs file, update all the occurrences of %DOCKER_REPO% with the docker-images repository location, which is the complete path of imagetool-setup/docker-images.

    For example, update:

    %DOCKER_REPO%/OracleWebCenterSites/imagetool/12.2.1.4/

    to:
    <imagetool-setup-location>/docker-images/OracleWebCenterSites/imagetool/12.2.1.4/

  2. Similarly, update the placeholders %JDK_VERSION% and %BUILDTAG% with appropriate values.

Create the image
  1. Add a JDK package to the WebLogic Image Tool cache:

    $ imagetool cache addInstaller --type jdk --version 8u291 --path <download location>/jdk-8u291-linux-x64.tar.gz
    
  2. Add the downloaded installation binaries to the WebLogic Image Tool cache:

    $ imagetool cache addInstaller --type fmw --version 12.2.1.4.0 --path <download location>/fmw_12.2.1.4.0_infrastructure.jar
    
    $ imagetool cache addInstaller --type wcs --version 12.2.1.4.0 --path <download location>/fmw_12.2.1.4.0_wcsites.jar
    
    
  3. Add the downloaded patches to the WebLogic Image Tool cache:

    Click here to see the commands to add patches in to the cache:
  4. Update the patches list to buildArgs.

    To the create command in the buildArgs file, append the Oracle WebCenter Sites patches list using the --patches flag and Opatch patch using the --opatchBugNumber flag. Sample options for the list of patches above are:

    --patches 34012040_12.2.1.4.0,33902201_12.2.1.4.0,33975762_12.2.1.4.0
    --opatchBugNumber=28186730_13.9.4.2.8
    
    

    Example buildArgs file after appending product’s list of patches and Opatch patch:

    create
    --jdkVersion=8u291
    --type WCS
    --version=12.2.1.4.0
    --tag=oracle/wcsites:12.2.1.4
    --installerResponseFile %path-to-downloaded-docker-repo%/OracleWebCenterSites/dockerfiles/12.2.1.4.0/wcs.file,%path-to-downloaded-docker-repo%/OracleWebCenterSites/dockerfiles/12.2.1.4.0/install.file
    --additionalBuildCommands %path-to-downloaded-docker-repo%/OracleWebCenterSites/imagetool/12.2.1.4.0/addtionalBuildCmds.txt --additionalBuildFiles %path-to-downloaded-docker-repo%/OracleWebCenterSites/dockerfiles/12.2.1.4.0/sites-container-scripts,%path-to-downloaded-docker-repo%/OracleWebCenterSites/dockerfiles/12.2.1.4.0/wcs-wls-docker-install
    --patches 34012040_12.2.1.4.0,33902201_12.2.1.4.0,33975762_12.2.1.4.0
    --opatchBugNumber=28186730_13.9.4.2.8
       
    

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

  5. Create a wcs-wls-docker-install installer jar

cd %docker_repo%/OracleWebCenterSites/dockerfiles/12.2.1.4/wcs-wls-docker-install
docker run --rm -u root -v ${PWD}:/wcs-wls-docker-install groovy:2.4.8-jdk8 /wcs-wls-docker-install/packagejar.sh

  1. Enter the following command to create the Oracle WebCenter Sites image:

    $ imagetool @<absolute path to `buildargs` file>"
    
    Click here to see the sample Dockerfile generated with the imagetool command.
  2. Check the created image using the Docker images command:

      $ Docker images | grep wcsites
    

Update an image

After setting up the WebLogic Image Tool and required build scripts, use the WebLogic Image Tool to update an existing Oracle WebCenter Sites Docker image:

  1. Enter the following command for each patch to add the required patch(es) to the WebLogic Image Tool cache:

    $  cd <imagetool-setup>
    $ imagetool cache addEntry --key 33975762_12.2.1.4.0 --value < %path-to-downloaded-pathes%/patches/p33975762_122140_Generic.zip
    [INFO] Added entry 33975762_12.2.1.4.0=< %path-to-downloaded-pathes%/patches/p33975762_122140_Generic.zip
    
  2. 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/wcsites:12.2.1.4-21.1.1.
    • –-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.

    Examples
    Click here to see the example `update` command:
    Click here to see the example Dockerfile generated by the WebLogic Image Tool with the `–-dryRun` option:
  3. Check the built image using the Docker images command:

      $ Docker images | grep wcsites
      oracle/wcsites   12.2.1.4.0-33975762   2ef2a67a685b        About a minute ago   2.84GB
      oracle/wcsites   12.2.1.4.0            445b649a3459        4 days ago           3.2GB
    
    

Create an Oracle WebCenter Sites Docker image using Dockerfile

For test and development purposes, you can create an Oracle WebCenter Sites image using the Dockerfile. Consult the README file for important prerequisite steps, such as building or pulling the Server JRE Docker image, Oracle FMW Infrastructure Docker image, and downloading the Oracle WebCenter Sites installer and bundle patch binaries.

A prebuilt Oracle Fusion Middleware Infrastructure image, container-registry.oracle.com/middleware/fmw-infrastructure:12.2.1.4, is available at container-registry.oracle.com. We recommend that you pull and rename this image to build the Oracle WebCenter Sites image.

  $ docker pull <path-to-container-registry>/fmw-infrastructure:12.2.1.4
  $ docker tag <path-to-container-registry>/fmw-infrastructure:12.2.1.4  oracle/fmw-infrastructure:12.2.1.4

Follow these steps to build an Oracle Fusion Middleware Infrastructure image, and then the Oracle WebCenter Sites image as a layer on top of that:

  1. Make a local clone of the sample repository:

    $ git clone https://github.com/oracle/docker-images
    
  2. Build the oracle/fmw-infrastructure:12.2.1.4 image:

     $ cd docker-images/OracleFMWInfrastructure/dockerfiles
     $ sh buildDockerImage.sh -v 12.2.1.4 -s
    

    This will produce an image named oracle/fmw-infrastructure:12.2.1.4.

  3. Download the Oracle WebCenter Sites installer from the Oracle Technology Network or e-delivery.

    Note: Copy the installer binaries to the same location as the Dockerfile.

  4. To build the Oracle WebCenter Sites image with patches, you must download and drop the patch zip files (for example, p33975762_122140_Generic.zip) into the patches/ folder under the version that is required. For example, for 12.2.1.4 the folder is 12.2.1.4/patches.

  5. Create the Oracle WebCenter Sites image by running the provided script:

    $ cd docker-images/OracleWebCenterSites/dockerfiles
    $ ./buildDockerImage.sh -v 12.2.1.4 -s
    

    The image produced will be named oracle/wcsites:12.2.1.4. The samples and instructions assume the Oracle WebCenter Sites image is named wcsites:12.2.1.4. You must rename your image to match this name, or update the samples to refer to the image you created.