Setting up init container for resources
Invoke the following command to create a
init-dockerfile.
FROM registry.access.redhat.com/ubi8/ubi:latest
RUN mkdir -p /jdbc_drivers/
COPY --chown=$CONTAINER_USER <all file names with space between them> /jdbc_drivers/
RUN chmod -R 775 /jdbc_drivers/
Invoke the following command to create init container
image:
$ docker build -f init-dockerfile -t <container image name> .
This image needs to be pushed inside OpenShift or local registry for accessing inside cluster
using either docker or podman:
- Login to
registry:
$ docker login <registry URL> -u <registry user> -p <registry user password> $ podman login <registry URL> -u <registry user> -p <registry user password>
- Tag image with
registry:
$ docker tag <wrapper image name with tag created above> <registry url>/<image name>:<tag> $ podman tag <wrapper image name with tag created above> <registry url>/<image name>:<tag>
- Push image to
registry:
$ docker push <registry url>/<image name>:<tag> $ podman push <registry url>/<image name>:<tag>
- This image will now be utilized in the init container image section to pass files, including database drivers, inside the container.