Customizing the Web server Docker container

If you need to customize the Web server Docker container, you can create customized configuration files and build a new Web server Docker image.

You can customize the httpd.conf and plugin-cfg.xml files.
Note:
HCL Commerce Version 9.1.14.0 or laterImportant:
  • Beginning in HCL Commerce 9.1.14.0, application container images are built to be run as a non-root user by default. This change has the potential to break your custom deployment. Therefore, you must review this change and its potential impacts. For more information, see HCL Commerce container users and privileges.
  • New Dockerfile content is introduced for releases of HCL Commerce 9.1.14.0 and greater due to the introduction of the non-root user, comuser, along with the container operating system migration from CentOS to UBI8 that occurred in the same release. For more information, see HCL Commerce 9.1.14.1.

Procedure

  1. Copy the httpd.conf and plugin-cfg.xml files to your Docker host machine to edit.
    For example,
    docker cp web_container_name:/opt/WebSphere/Plugins/config/templates/plugin-cfg.xml .
    and
    docker cp web_container_name:/opt/WebSphere/HTTPServer/conf/httpd.conf .
    The period (.) at the end of the command copies the files to the current working directory. Modify the command if you want to copy to a different directory.
  2. Edit the httpd.conf and plugin-cfg.xml files to add forward requests or request limitations.
    Note: Ensure that you adhere to the following configuration guidelines when editing the files.
    • For httpd.conf, do not remove the existing virtual host definition. You can add new records to the existing virtual host definition, or add a new virtual host definition with a new port.
    • For plugin-cfg.xml, do not remove the existing Uri, Urigroup, VirtualHostGroup, Route, and Servercluster definitions. You can add new records to the existing definitions or create new definitions for these objects.
  3. Create a Dockerfile with the following contents.
    HCL Commerce Version 9.1.14.0 or later
    FROM Docker_registry/commerce/ts-web:source_image_tag 
    USER root 
    RUN dnf install -y nc && dnf clean all
    USER comuser 
    HEALTHCHECK --interval=10s CMD nc localhost 8000 < /dev/null  
    #If you migrated from HCL Commerce V7 or V8, and are using the migrated local store, uncomment the next line.   
    #COPY -chown=comuser:comuser localStoreStaticAsset/ /SETUP/Cus/  
    #For local store assets, there is a built-in request forward configuration in httpd.conf and plugin-cfg.xml.  
    #The built-in store configuration is only needed for the migrated local store, not the Version 9 remote store. 
    COPY -chown=comuser:comuser SETUP /SETUP
    For releases of HCL Commerce 9.1.0.0 to 9.1.13.0:
    FROM Docker_registry/commerce/ts-web:source_image_tag
    RUN yum install -y nc && yum clean all HEALTHCHECK --interval=10s CMD nc localhost 8000 < /dev/null 
    #If you migrated from HCL Commerce V7 or V8, and are using the migrated local store, uncomment the next line.  
    #COPY localStoreStaticAsset/ /SETUP/Cus/ 
    #For local store assets, there is a built-in request forward configuration in httpd.conf and plugin-cfg.xml. 
    #The built-in store configuration is only needed for the migrated local store, not the Version 9 remote store.
    COPY SETUP /SETUP
    Docker_registry
    The Docker registry URL where the source image is located.
    source_image_tag
    The tag of the source image that you want to use.
  4. Create a SETUP/config folder in the same directory as the Dockerfile.
    Your directory structure should resemble the following tree.
    • Dockerfile
    • SETUP
      • Config
  5. Move the customized httpd.conf and plugin-cfg.xml files to the /SETUP/config folder.
  6. Build the new Web server Docker image.

    For information about how to build, see Dockerfile reference.

    If you want to use Docker Compose, you can reference the following topic that shows how to update your compose file, Building a custom Docker image from a deployable package.