Customize the Web server Docker container
If you need to customize the Web server Docker container, we can create customized configuration files and build a new Web server Docker image. We can customize the httpd.conf and plugin-cfg.xml files.
Procedure
- Copy the httpd.conf and plugin-cfg.xml files to our 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 to copy to a different directory.
- 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. We 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. We can add new records to the existing definitions or create new definitions for these objects.
- Create a Dockerfile with the following contents.
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 WebSphere 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 to use.
- Create a SETUP/config folder in the same directory as the Dockerfile. Your directory structure should resemble the following tree.
- Dockerfile
- SETUP
- Config
- Move the customized httpd.conf and plugin-cfg.xml files to the /SETUP/config folder.
- Build the new Web server Docker image.
For information about how to build, see Dockerfile reference.
To use Docker Compose, we can reference the following topic that shows how to update your compose file, Building custom Docker images based on customization packages.