Building Custom Init Container Image
A custom init container image can be built either from scratch or by extending the default init container image.
A custom init container image can be built with the required resource artifacts or packages and configured as the init container in .Values.resourcesInit section. The custom image can also be built by extending the default resources init image available out of the box.
The following is a sample Dockerfile to build an image for packaging external resources:
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
#Adding db driver jar
COPY ./db2jcc4.jar /resources
#Adding SEAS integration jars
COPY ./seas/*.jar /resources/seas
#Add any other required resources to the same location
ENTRYPOINT [“sh”, “-c”, “cp -rv /resources/* /ibm/resources”]
- The Dockerfile must be placed along with the required resources in a common source location (/path/to/build), and the following command must be used to build the image:
cd /path/to/build docker build . -t <name:tag> # for ex b2bi-init:1.0
- Push the image to the private image registry accessible to the OpenShift or Kubernetes cluster using the following command:
docker tag b2bi-init:1.0 <private registry url>/b2bi-init:1.0 docker push <private registry url>/b2bi-init:1.0
-
This image can now be configured as the init container for the application containers:
# resourcesInit section to configure init container for external resources resourcesInit: # enabled can be set to true to configure resources init container enabled: true image: # repository for the init container image repository: <private registry url> # name for the init container image name: b2bi-init # tag for the init container image. Optional if digest is provided. tag: 1.0 # digest for the init container image. Optional if tag is provided. digest: # pullPolicy for the init container image pullPolicy: "IfNotPresent" # command to execute for the init container
Note: The following are a few approved locations for downloading database driver jars from database vendors:
- Oracle On-Premises
- Amazon RDS
- Microsoft SQL Server On-Premises
- License: Included in the tar.gz which can be found at the download link for the drivers.
- Drivers: docs.microsoft.com/en-us/sql/connect/jdbc/microsoft-jdbc-driver-for-sql-server?view=sql-server-ver16
- DB2 On-Premises and as a service on IBM Cloud