9.2 Creating an Image

Before creating an Oracle HTTP Server (OHS) image, make sure you have followed Setting Up the WebLogic Image Tool.

9.2.1 Exporting the PWD Variable

In order for the WebLogic Image Tool to build OHS with all the latest patches, the image creation downloads patches from My Oracle Support.

During the image build you are asked to enter your My Oracle Support credentials, however the password is passed as a variable. Set the variable as follows:
export MYPWD="MY_ORACLE_SUPPORT_PWD"

9.2.2 Downloading the OHS Installation Binaries and Patches

You must download the required Oracle HTTP Server (OHS) installation binaries and JDK as listed below from Oracle Software Delivery Cloud and My Oracle Support. Save them to a directory of your choice.

The installation binaries and JDK required are:
  • Oracle Web Tier 14.1.2.0.0
    • V1045136-01.zip

      Note:

      You will need to unzip the file after downloading to get the fmw_14.1.2.0.0_ohs_linux64.bin which is used with the imageTool.
  • Oracle JDK v17 or v21
    • jdk-17.X.X_linux-x64.tar.gz or jdk-21.X.X_linux-x64.tar.gz

      Note:

      17.0.14 or higher, or 21.0.6 or higher are supported.

9.2.3 Updating the Required Build Files

The following files are used for creating the image. These files must be updated before creating the image:
  • additionalBuildCmds.txt
  • buildArgs
  1. Create the <workdir>/imagetool-setup/docker-images/OracleHTTPServer/additionalBuildCmds.txt file and add the following:
    [package-manager-packages]
    binutils make glibc-devel procps
    [final-build-commands]
    ENV PATH=$PATH:/u01/oracle/ohssa/oracle_common/common/bin \
        NM_PORT=5556 \
        OHS_LISTEN_PORT=7777 \
        OHS_SSL_PORT=4443 \
        MW_HOME=/u01/oracle/ohssa \
        DOMAIN_NAME=ohsDomain \
        OHS_COMPONENT_NAME=ohs1 \
        PATH=$PATH:$ORACLE_HOME/oracle_common/common/bin:$ORACLE_HOME/user_projects/domains/ohsDomain/bin:/u01/oracle/ \
        WLST_HOME=/u01/oracle/ohssa/oracle_common/common/bin
    COPY --chown=oracle:root files/create-sa-ohs-domain.py files/configureWLSProxyPlugin.sh files/mod_wl_ohs.conf.sample files/provisionOHS.sh files/start-ohs.py files/stop-ohs.py files/helloWorld.html /u01/oracle/
    WORKDIR ${ORACLE_HOME}
    CMD ["/u01/oracle/provisionOHS.sh"]

    Note:

    Administrators should be aware of the following:
    • oracle:root is used for OpenShift which has more stringent policies. Users who do not want those permissions can change to the permissions they require.
    • The packages listed in the [package-manager-packages] is for Oracle Linux 8 images. If you want to build Oracle Linux 9 images you need to add libxcrypt-compat to this list also.
  2. Create the <workdir>/imagetool-setup/docker-images/OracleHTTPServer/buildArgs file as follows and change the following:
    • <workdir> to your working directory, for example /scratch/
    • %BUILDTAG% to the tag you want create for the image, for example oracle/ohs:14.1.2.0.0
    • %JDK_VERSION% to the version of your JDK, for example 21.0.6
    • <user> to your My Oracle Support username
    create
    --tag=%BUILDTAG%
    --additionalBuildCommands /<workdir>/imagetool-setup/docker-images/OracleHTTPServer/additionalBuildCmds.txt
    --additionalBuildFiles <workdir>/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/create-sa-ohs-domain.py,<workdir>/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/provisionOHS.sh,<workdir>/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/configureWLSProxyPlugin.sh,<workdir>/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/mod_wl_ohs.conf.sample,<workdir>/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/start-ohs.py,<workdir>/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/stop-ohs.py,<workdir>/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/helloWorld.html
    --type=OHS
    --pull
    --recommendedPatches
    --chown=oracle:root
    --user=<user>
    --passwordEnv=MYPWD
    --version=14.1.2.0.0
    --jdkVersion=<version>
    For example:
    create
    --tag=oracle/ohs:14.1.2.0.0
    --additionalBuildCommands /scratch/imagetool-setup/docker-images/OracleHTTPServer/additionalBuildCmds.txt
    --additionalBuildFiles /scratch/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/create-sa-ohs-domain.py,/scratch/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/provisionOHS.sh,/scratch/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/configureWLSProxyPlugin.sh,/scratch/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/mod_wl_ohs.conf.sample,/scratch/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/start-ohs.py,/scratch/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/stop-ohs.py,/scratch/imagetool-setup/docker-images/OracleHTTPServer/dockerfiles/14.1.2.0.0/container-scripts/helloWorld.html
    --type=OHS
    --pull
    --recommendedPatches
    --chown=oracle:root
    --user=user@example.com
    --passwordEnv=MYPWD
    --version=14.1.2.0.0
    --jdkVersion=21.0.6

    Note:

    jdkVersion can also be 17.0.14 or higher.
    For more information on the complete list of options available with the WebLogic Image Tool create command. see Create Image.

9.2.4 Creating the Image

To create the OHS image, run the following commands:
  1. Add the JDK package to the WebLogic Image Tool cache. For example:
    imagetool cache addInstaller --type jdk --version 21.0.6 --path <download location>/jdk-21_linux-x64.tar.gz
  2. Add the downloaded installation binaries to the WebLogic Image Tool cache. For example:
    imagetool cache addInstaller --type ohs --version 14.1.2.0.0 --path <download location>/fmw_14.1.2.0.0_ohs_linux64.bin
  3. Create the Oracle HTTP Server image:
    imagetool @<absolute path to buildargs file>

    Note:

    By default ImageTool builds an image with Oracle Linux 8. If you want to build an image with Oracle Linux 9. you must append --fromImage ghcr.io/oracle/oraclelinux:9-slim to the image tool command.
    For example for Oracle Linux 8:
    imagetool @/scratch/imagetool-setup/docker-images/OracleHTTPServer/buildArgs
    For Oracle Linux 9:
    imagetool @/scratch/imagetool-setup/docker-images/OracleHTTPServer/buildArgs --fromImage ghcr.io/oracle/oraclelinux:9-slim
  4. After the image has been created, check the created image using the docker images command:
    docker images | grep ohs
    The output will look similar to the following:
    oracle/ohs:14.1.2.0.0                14.1.2.0.0                     ad732fc7c16b        About a minute ago   3.68GB
  5. If you want to see what patches were installed, you can run:
    imagetool inspect --image=<REPOSITORY>:<TAG> --patches
    For example:
    imagetool inspect --image=oracle/ohs:14.1.2.0.0 --patches
  6. 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/ohs14.1.2.tar oracle/ohs:14.1.2.0.0